0
我想我的网站像example.com/anypage
重定向到www.example.com/anypage
额外的斜线303之后重定向
这是我使用的是什么在我的httpd.conf文件
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [nocase]
RewriteRule ^(.*) http://www.example.com/$1 [last,redirect=301]
这重定向页面到www.example.com//anypage
如何删除多余的斜杠?
[在每服务器/虚拟主机和每个目录的配置中使用时的mod_rewrite表现不同] /httpd.apache.org/docs/current/rewrite/tech.html):“在每个目录的上下文中(即在'.htaccess'文件和'Directory'块中),mod_rewrite最初的URL路径比较'RewriteRule'指令是完整的文件系统路径到当前目录路径(包括一个尾部斜杠)的转换后的文件名**。“ – Gumbo
@Gumbo的含义我应该使用'http:// www.example.com $ 1'作为'RewriteRule' ? –
要么是这样,要么你不应该捕获前导斜线。 – Gumbo