![](/img/trans.png)
[英].htaccess 301 redirect from one subdirectory to another and preserve folder/directory structure
[英]Htaccess 301 redirect from one directory to its subdirectory and keeping the main directory url accesible
我正在尝试重定向下面的所有页面
至
以及如何使目录url可访问,因为该目录url还包含我需要显示的内容,并且我使用了此htaccess代码
RewriteRule ^/directory/(.*)$ /directory/supplier/$1 [L,R=301,NC]
但它不起作用。
从重写模式中删除前导斜杠,就可以了
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/directory/supplier/
RewriteRule ^directory/(.+)$ /directory/supplier/$1 [L,R=301,NC]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.