为什么根据我的RewriteRule的位置得到一个双尾斜杠?
我正在使用以下代码将所有www请求指向非wwwurl: RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.example\.org$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] 这在我的网站根目录下的.htaccess文件里面工作的很好。 例如, www.example.com – > example.com/ www.example.com/ – > example.com/ www.example.com/other_page – > example.com/other_page 但是,如果将相同的代码移到我的VirtualHostconfiguration中,则重写的URL将包含一个双尾斜杠。 www.example.com – > example.com// www.example.com/ – > example.com// www.example.com/other_page – > example.com//other_page 我通过从重写规则中删除斜线来修复它: RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.example\.org$ [NC] RewriteRule ^(.*)$ http://example.com$1 [R=301,L] 但是我不明白这个原因。 任何人知道为什么