[英]Htaccess rewriterule /a to /a/b
I try to prepare rewrite rule from directory /a/
to subfolder /a/b/
, but I receive information that my rewrite rule is circular, so I receive as output URL
as localhost/a/b/a/b/a/a/b
in order to request localhost/a/. 我尝试从目录
/a/
到子文件夹/a/b/
准备重写规则,但我收到的信息是我的重写规则是循环的,所以我收到的output URL
为localhost/a/b/a/b/a/a/b
为了请求localhost / a /。 I would like to receive: 我想收到:
localhost/a and rewrite to localhost/a/b
I try: 我尝试:
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/a/b
RewriteRule ^/a(.*)$ /a/b/$1 [L]
Inside /a/.htaccess
have this rule: 在
/a/.htaccess
里面有这个规则:
RewriteEngine on
RewriteBase /a/
RewriteRule ^((?!b/).*)$ b/$1 [NC,L,R=302]
If you want to skip actual files/directories from this redirect then use: 如果要从此重定向跳过实际文件/目录,请使用:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?!b/).*)$ b/$1 [NC,L,R=302]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.