To redirect the whole website
Redirect 301 / http://www.domainname.com/
To redirect a particular directory
RedirectMatch 301 ^/directoryname/$ http://www.domainname/
To redirect non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domainname\.com$
RewriteRule (.*) http://www.domainname.com/$1 [R=301,L]
To redirect www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^domainname\.com$
RewriteRule (.*) http://domainname.com/$1 [R=301,L]

0 comments:
Post a Comment