Try this:

Non-www to www:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]

www to non-www:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]

Bonus tip: Remove trailing slash from address line

RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

more here:http://planetcakephp.org/aggregator/items/271-generic-non-
www-to-www-and-vice-versa-301-redirect-using-htaccess

On Sep 20, 12:24 pm, Petr Vytlačil <[email protected]> wrote:
> How setting htaccess for redirecthttp://example.comtohttp://www.example.com
> and where in dir structure cakephp.
>
> THX

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to