.htaccess mod_rewrite 用于嵌套文件夹结构
我最近在网上发现一篇文章告诉我这一点:
RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1§ion=$2 [NC]
现在唯一让我发疯的是我是否想要能够拥有第二个目录。就像:
RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1§ion=$2 [NC]
RewriteRule ^mock-up/([^/]+) /mock-up/index.php?page=$1 [NC]
但这破坏了阿帕奇......那么该怎么办?请帮忙,我需要为我的客户进行搜索引擎优化,我不想为此制作单独的文件。
I recently found an article online that told me about this:
RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1§ion=$2 [NC]
Only thing that is driving me crazy right now is if I want to be able to have the 2nd directory or not. Like:
RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1§ion=$2 [NC]
RewriteRule ^mock-up/([^/]+) /mock-up/index.php?page=$1 [NC]
But that's breaking apache... so what to do? Please help, I need to seo for my client and I would prefer not to have to make individual files for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是
mock-up/index.php
也与mock-up/([^/]+)
匹配。因此,您需要直接排除目标:或间接排除:
所以试试这个:
The problem is that
mock-up/index.php
is also matched bymock-up/([^/]+)
. So you need to exclude the target, either directly:Or indirectly:
So try this: