Wildcard .htaccess redirect

Advert test


Staff member
I can probably ask one of our guys on Tuesday - he's a bit of a whiz with regular expressions + mod_rewrite ..
.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,

would redirect to

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]