我怎样才能重定向所有非www链接到www的链接?我发现在互联网上的解决方案,但他们只重定向域名。
如何让我这个一般:
http://example.com/testing
应重定向到 http://www.example.com/testing
?
How can I redirect all non-www links to www links? I have found solutions on the internet, but they only redirect the domain name.
How do I make this general:
http://example.com/testing
should redirect to http://www.example.com/testing
?
尝试这样的事情
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]