How to redirect all urls to a www. subdomain
I've got this rewrite in my .htaccess:
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^domain.com/$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Which works fine for domain.com but doesn't redirect the URL with something after the /
(domain.com/something.php should redirect to www.domain.com/something.php)
How can this be done?开发者_开发知识库
Thanks in advance!!
check it out
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]
My guess its because you write ^domain.com/$
- the dollar sign at the end means end of the string, so nothing can be after it - that is why it works with domain.com, but does not work with something more?
精彩评论