Apache Server | htaccess 301 redirect
To make sure search engines consider both www and non-www sites as one, we should create a 301 redirect rule from one to the other. Here's how:
http://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www
#comments can be added by ignoring lines with this initial character
#this script redirects a specific domain to its www domain
#Options +FollowSymlinks
#RewriteEngine on
#rewritecond %{http_host} ^yourdomain.com [nc]
#rewriterule ^(.*)$ http://www.yourdomain.com/$1 [r=301,nc]
#this script redirects generically all www domains to non www-domains
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
http://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www
Comments
Post a Comment