Reputation: 38529
I've got the following 301 redirect in my .htaccess
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^old-site\.com,$ http://www.new-site.com/? [R=301,NE,NC,L]
If i visit
old-site.com
I am redirected correctly.
However, if I visit www.old-site.com, then it doesn't work.
Is there a way of effectively ignoring the www
Edit
There are several entries like this...
for example:
www.old-site.com/page-a-242.html
to www.new-site.com/page-a
Upvotes: 1
Views: 162
Reputation: 74038
RewriteRule
ignores the domain, so your first rule could be just
RewriteRule ^$ http://www.new-site.com/? [R,L]
For the other specific mappings you might use RewriteMap
. See txt: Plain text maps for details on how to use it.
The drawback with RewriteMap
is, that it can only be used in the main server config or in a virtual host environment.
Upvotes: 1