I have a joomla 1.6 website, and I want to enforce a www in the beginning of urls. I've written the following into htaccess:
RewriteCond %{http_host} ^example\.com [nc]
RewriteRule (.*) http://www.example.com/$1 [r=301,nc]
What it should do is redirect from example.com/happy_bunnies.html to www.example.com/happy_bunnies.html. Instead it redirects to www.example.com/index.php
RewriteCond %{http_host} ^example\.com [nc]
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule .* http://www.example.com%1 [r=301,nc,l]
No idea why the开发者_JAVA技巧 first didn't work, but this one does
Have you tried...
RewriteCond %{http_host} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,NC]
精彩评论