There is a project that requires me to make the following domain redirection:
- Redirect all users to access the site WITHOUT the 'www.' prefix for all subdomain.
- Redirect all users to access the site WITH the 'www.' prefix for main domain only.
To fulfill this purpose, I simply add a few lines of code to the htaccess file.
RewriteEngine on# Redirect the 'www.' version of the subdomains.
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.example\.com [NC]
RewriteRule ^(.*)$ http://%1.example.com/$1 [R=301,L]# Redirect the non 'www.' version of the main domain.
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]Read more Redirect non www to www or vice versa (main domain, subdomain)
Redirect non www to www or vice versa (main domain, subdomain)
Thu, 2012-11-22 15:42
#1



So you do 301 redirect Dan. I
So you do 301 redirect Dan. I have read that it will drive links on the old website to the new one, so the new one has the same links as before. It's good for permanent move.
Bursa Properti Batik Jogja Jejak Petualang de Java
think
I think you better to choose Redirect all users to access the site WITH the 'www.' prefix for main domain only
Septictankbiorich.comBiotech System
SeptictankbiorichBioRich, Biotech, Biofil
Surya Utama FibertechFibreglass
Actually, the good life www
Actually, the good life www or no www, I am still a bit confused
Kanghari Khanza Aulia Shafira Nugroho Blog Kanghari Animal World