Return to Snippet

Revision: 28942
at July 16, 2010 23:39 by beneberle


Initial Code
# This chain of rules will rewrite old-domain, www.old-domain, and new-domain to www.new-domain

rewriteCond %{http_host} ^old-domain\.com$ [OR]
rewriteCond %{http_host} ^www.old-domain\.com$ [OR]
rewriteCond %{http_host} ^old-domain\.org$ [OR]
rewriteCond %{http_host} ^www.old-domain\.org$ [OR]
rewriteCond %{http_host} ^new-domain\.com$ [NC]
rewriteRule ^(.*)$ http://www.new-domain.com/$1 [r=301,L]

Initial URL

                                

Initial Description
This is good for ensuring your domain is always either accessed with or without the www, which is important for SEO. It is also good if you have multiple domains that should resolve to the same site, and can redirect all requests to the main domain.

Initial Title
.htaccess URL Rewrites

Initial Tags
redirect, htaccess

Initial Language
Apache