我试图在主目录的.htaccess文件中使用RewriteRule将一个子目录重定向到另一个子目录。htaccess如果没有结尾的斜杠,RewriteRule不能正常工作
例如:http://website.com/subdir应重写为http://website.com/another_dir/destination_dir,但用户仍应在地址栏中看到http://website.com/subdir。
如果用户使用尾部斜线结束URL,则此功能完美无缺。例如:http://website.com/subdir/(生成一个200
然而,如果省略了斜线,则产生301重定向和我们所看到的不希望的目标目录例如,http://website/subdir将用户重定向到http://website/another_dir/destination_dir
下面是有关部分。的.htaccess的:
# URL Rewriting:
RewriteEngine On
RewriteBase/
...
# Redirect subdirectories:
RewriteRule ^subdir(.*)$ another_dir/destination_dir$1 [PT,NC,QSA,L]
任何援助表示赞赏