.htaccess 是否将dir/page/page重定向设置为与dir/page不同?
我有一些.htaccess 是否将dir/page/page重定向设置为与dir/page不同?,.htaccess,url,mod-rewrite,url-rewriting,.htaccess,Url,Mod Rewrite,Url Rewriting,我有一些.htaccess重写规则,如下所示: RewriteRule name/john item.php?id=1 [NC,L,QSA] RewriteRule name/jill item.php?id=2 [NC,L,QSA] 在上面的页面上,我想链接到类似于name/john/profile的内容。我尝试了以下规则: RewriteRule name/john/profile profile.php?id=1 [NC,L,QSA] RewriteRule name/jill/prof
.htaccess
重写规则,如下所示:
RewriteRule name/john item.php?id=1 [NC,L,QSA]
RewriteRule name/jill item.php?id=2 [NC,L,QSA]
在上面的页面上,我想链接到类似于name/john/profile
的内容。我尝试了以下规则:
RewriteRule name/john/profile profile.php?id=1 [NC,L,QSA]
RewriteRule name/jill/profile profile.php?id=2 [NC,L,QSA]
但是单击这些链接会重定向到item.php
,而不是profile.php
是否无法使用更深层的规则,或者我是否缺少一个标志?您可以使用:
RewriteRule ^name/john/?$ item.php?id=1 [NC,L,QSA]
RewriteRule ^name/jill/?$ item.php?id=2 [NC,L,QSA]
RewriteRule ^name/john/profile/?$ profile.php?id=1 [NC,L,QSA]
RewriteRule ^name/jill/profile/?$ profile.php?id=2 [NC,L,QSA]
我喜欢添加/?
,因为在这之后可以使用final/