我有一个网站,可以使用“www”和不使用“www”(例如www.example.com和example.com)访问它。如果 URL 中没有“www”,则 mod_rewrite 用于重定向到 www.example.com。
但是,如果我去example.com/something.html,它会被重定向到www.example.com(something.html被截断)。
目前,我的规则是:
<VirtualHost *:80>
ServerName example.com
RewriteEngine On
RewriteRule /.* http://www.example.com [R]
</VirtualHost>
使重写递归和使example.com/something.html重定向到www.example.com/something.html的最简单方法是什么