Ok, thanks for all the good feedback, guys. To confirm...

My website is hosted on a shared server, so my doc root is public_html, in 
which I have a Cake installation.

public_html
     - app
          - webroot
               - .htaccess  *(3)*
          - .htaccess  *(2)*
     - libs
     - plugins
     - vendors
     - .htaccess  *(1)*
     - index.php

That being said, which .htaccess file should I place my redirect 
conditions/rules in? 1, 2, or 3?

Also, as kdubya posted, here is the condition/rule I plan on using:

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ 
"http\:\/\/www.domain.com<http://www.google.com/url?sa=D&q=www.domain.com&usg=AFQjCNF2VZnNvBDuFoDgI6jKjQM0LVHXaA>"
 
[R=301,L]

Is this the best/correct usage?



On Friday, April 13, 2012 8:37:46 PM UTC-5, euromark wrote:
>
> @kdubya: thats actually how you normally do it anyway
> what kdubya wants is just not how it is done... (you always use www as the 
> actual site and 301 redirect from non-www there) imo
>
>
> Am Freitag, 13. April 2012 15:51:52 UTC+2 schrieb kdubya:
>>
>> I realized I answered only part of your question. I have done the 
>> opposite of what you are asking - redirecting domain.tld -> www.domain.tld 
>> (making the www.domain.tld the canonical URL).
>>
>> The /site/.htaccess file I use contains:
>> <IfModule mod_rewrite.c>
>>    RewriteEngine on
>>       
>>    RewriteCond %{HTTP_HOST} ^domain.com$ 
>>    RewriteRule ^/?$ "http\:\/\/www.domain.com" [R=301,L]
>>       
>>    RewriteRule    ^$ app/webroot/    [L]
>>    RewriteRule    (.*) app/webroot/$1 [L]
>> </IfModule>
>>
>> HTH,
>> Ken
>>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to