Wildcard .htaccess redirect

Status
Not open for further replies.

mneylon

Administrator
Staff member
I can probably ask one of our guys on Tuesday - he's a bit of a whiz with regular expressions + mod_rewrite ..
 

figment

New Member
Thanks for all the help Guys.
The solution that worked was:

RewriteEngine On
RewriteRule .* http://www.domain.com/ [R=301,L]

PHP.Allstar for some reason removing the brackets in your solution made the difference.

Alan
 

methodshop

New Member
.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.
Award-winning Mac antivirus and Internet security software
Top