如果访问者在example.com
处输入example.com/sub/folder/
,那么是否可以这样做,即网址栏会显示example.com/sub/folder/
?
这是我的.htaccess文件:
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
答案 0 :(得分:0)
尝试:
RewriteMatch 301 ^/$ /sub/folder
或:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/sub/folder
RewriteRule ^(.*)$ /sub/folder/$1 [L,R=301]