Forum Moderators: phranque
I tried using the mod rewrite rule posted here:
[webmasterworld.com...]
The result was that while the old .net domain now gives the proper 301 redirect, the new .com one does as well.
The rewrite rule I used was:
RewriteEngine on
RewriteCond %{HTTP_HOST]!^www\.mysite\.com$
RewriteRule (.*) [mysite.com...] [R=permanent,L]
Any help would be appreciated. I have learned a lot from this site.
RewriteEngine on
RewriteCond %{HTTP_HOST]!^www\.mysite\.com$
RewriteRule (.*) [mysite.com...] [R=permanent,L]
Try this:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mysite\.com
RewriteCond %{HTTP_HOST} !^123\.45\.67\.89
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=permanent,L]
The two most-likely causes of trouble are the missing spaces before the "!" characters, and the end-anchor on the HTTP_HOST pattern. Also include your IP address so you can get to your site in case of a DNS failure.
If you install the rewrite in httpd.conf rather than .htaccess, you'll need to modify the RewriteRule to handle the leading slash:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mysite\.com
RewriteCond %{HTTP_HOST} !^123\.45\.67\.89
RewriteRule ^(.*)$ http://www.mysite.com$1 [R=permanent,L]
HTH,
Jim