htaccess /index.php?u=xx&p=yy 至 /xx/yy/ URL 重写
我想知道如何将网址 /index.php?u=xx&p=yy
更改为 /xx/yy/
。
index.php 将被删除,u 和 p 值将带有斜杠标记。
htaccess 代码:
RewriteCond %{THE_REQUEST} /index\.php[\s?/] [NC]
RewriteRule ^(.*?)index\.php(/.*)?/?$ /$1$2 [L,R=301,NC,NE]
我使用了上面的代码,但它只删除了index.php。其他保持不变。
I would like to know how to URL change /index.php?u=xx&p=yy
to /xx/yy/
.
index.php will be removed and u and p values become with a slash mark.
htaccess code:
RewriteCond %{THE_REQUEST} /index\.php[\s?/] [NC]
RewriteRule ^(.*?)index\.php(/.*)?/?$ /$1$2 [L,R=301,NC,NE]
I have used the above code but it only removes index.php. Others are remaining the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您显示的示例/尝试,请尝试遵循 htaccess 规则。在测试您的网址之前,请确保清除浏览器缓存。
另请确保您的 htaccess 规则文件和 index.php 文件位于同一目录中。
With your shown samples/attempts, please try following htaccess rules. Please make sure to clear your browser cache before testing your URLs.
Also please make sure that your htaccess rules file and index.php files are in same directory.