我使用的Apache 2.2在Windows OS, 我需要非WWW网址重定向到www的网址,我在网上查,发现这似乎是工作了很多重定向非WWW网址,以WWW网址,通过htaccess的
RewriteCond %{HTTP_HOST} ^example\.co\.uk [NC]
RewriteRule ^(.*)$ http://www.example.co.uk/$1 [R=301,L]
但是,如果使用相同的重写规则,我得到的WWW网址,以点到底:
例如:
http://example.com/test redirects to
http://www.example.com.
$1 is "." and its failing to add all params
你可以把你写在.htaccess中的真实东西? – undone
@Aseman RewriteCond%{HTTP_HOST}^mysite \ .local [NC] RewriteRule ^(。*)$ http://www.mysite.local/$1 [R = 301,L] – Deepak