I am using CakePHP which already contains an .htaccess file that looks like:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]

I want to force www. (unless it is a subdomain) to avoid duplicate content penalties.

It needs to retain http or https


This application will have multiple domains pointing to it. So the code needs to be able to work with any domain.

migrated from serverfault.com Feb 9 '11 at 22:40

This question came from our site for system and network administrators.


Not to be evasive about your actual question, but Google was pretty clear that incidental duplication from things like this doesn't cause any penalties with their ranking algorithm:


I imagine that most search engines are not dumb enough to penalize the huge majority of sites on the Internet that respond to HTTP hosts with and without the leading "www."

  • Well, thats good news. That eliminates my need for this then. Thanks. – JD Isaacks Feb 10 '11 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.