Wildcard .htaccess redirect

Advert test
Status
Not open for further replies.

mneylon

Administrator
Staff member
#5
I can probably ask one of our guys on Tuesday - he's a bit of a whiz with regular expressions + mod_rewrite ..
 
#9
.htaccess wildcard redirect example

i own multiple domains for my site MethodShop, including methodshop.com, methodshop.net, etc.. When doing maintenance, i'll divert traffic between the different sites so my users don't have their experience interrupted. below is the htaccess wildcard script i use. it takes whatever URL the user attempts to access and mirrors that link on another domain.

for example,
http://www.methodshop.net/games/play/bubblewrap/index.shtml

would redirect to
http://www.methodshop.com/games/play/bubblewrap/index.shtml

here's the script....

#htaccess script for methodshop.net
#rewrites all methodshop.net URLs to methodshop.com

RewriteEngine on
RewriteRule (.*)$ http://www.methodshop.com\/$1 [R=301,L]
 
Status
Not open for further replies.
Top