- Joined
- Nov 27, 2006
- Messages
- 70
- Reaction score
- 0
Ok, I have a virtual host account with one Primary Domain in the Root folder and several Secondary Domains in sub-folders.
For consolidation of Google Page Ranking and avoidance of any possible duplicate content problems with referrals to Domain.com vs www.Domain.com, I have made a master .htaccess file that I copy to EACH Domain's folder to 301 Redirect any reference to Domain.com to www.Domain.com.
It all works fine. I currently have it coded as:
RewriteEngine on
Options +ExecCGI
rewritecond %{http_host} ^Domain1.com [nc]
rewriterule ^(.*)$ http://www.Domain1.com/$1 [r=301,nc]
rewritecond %{http_host} ^Domain2.com [nc]
rewriterule ^(.*)$ http://www.Domain2.com/$1 [r=301,nc]
rewritecond %{http_host} ^Domain3.com [nc]
rewriterule ^(.*)$ http://www.Domain3.com/$1 [r=301,nc]
...Etc.
I suspect with the proper wild-card coding, I could consolidate the multiple redirect directives into one that would say "redirect [AnyDomain].com to www.[AnyDomain].com", but I am not sure how to code this correctly. Since all the sites are live, I don't want to screw it up.
Anyone out there know how to code that properly???
For consolidation of Google Page Ranking and avoidance of any possible duplicate content problems with referrals to Domain.com vs www.Domain.com, I have made a master .htaccess file that I copy to EACH Domain's folder to 301 Redirect any reference to Domain.com to www.Domain.com.
It all works fine. I currently have it coded as:
RewriteEngine on
Options +ExecCGI
rewritecond %{http_host} ^Domain1.com [nc]
rewriterule ^(.*)$ http://www.Domain1.com/$1 [r=301,nc]
rewritecond %{http_host} ^Domain2.com [nc]
rewriterule ^(.*)$ http://www.Domain2.com/$1 [r=301,nc]
rewritecond %{http_host} ^Domain3.com [nc]
rewriterule ^(.*)$ http://www.Domain3.com/$1 [r=301,nc]
...Etc.
I suspect with the proper wild-card coding, I could consolidate the multiple redirect directives into one that would say "redirect [AnyDomain].com to www.[AnyDomain].com", but I am not sure how to code this correctly. Since all the sites are live, I don't want to screw it up.
Anyone out there know how to code that properly???