Wildcard domain redirect with WordPress Wildcard domain redirect with WordPress wordpress wordpress

Wildcard domain redirect with WordPress


Looks like I simply had to move the new rules above the WordPress section. I also added a new one that is supposed to remove the 'www' from the dot com domain name.

This all seems to be working.

Any comments appreciated.

# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{HTTP_HOST} ^blog.domain.info$ [OR]RewriteCond %{HTTP_HOST} ^www.blog.domain.info$ [OR]RewriteCond %{HTTP_HOST} ^www.blog.domain.com$RewriteRule ^(.*)$ "http\:\/\/blog\.domain\.com\/$1" [R=301,L]RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule># END WordPress

EDIT

It should be noted that if you change anything in the htaccess file contained between these Wordpress comments, it might get overwritten by Wordpress at a later time. Moving your custom edits outside AND above this block also works and is immune from any changes to htaccess made by Wordpress itself.

RewriteEngine OnRewriteBase /RewriteCond %{HTTP_HOST} ^blog.domain.info$ [OR]RewriteCond %{HTTP_HOST} ^www.blog.domain.info$ [OR]RewriteCond %{HTTP_HOST} ^www.blog.domain.com$RewriteRule ^(.*)$ "http\:\/\/blog\.domain\.com\/$1" [R=301,L]# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule># END WordPress


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://methodshop.NET/games/play/bubblewrap/index.shtml

would redirect tohttp://methodshop.COM/games/play/bubblewrap/index.shtml

here's the htaccess script for methodshop.net that rewrites all methodshop.net URLs to methodshop.com. just edit it for your domain.

RewriteEngine on

RewriteRule (.*)$ http://www.methodshop.com\/$1 [R=301,L]