使用 mod_rewrite 清理 URL
我正在尝试使用 mod_rewrite 清理我的 URL。
在我的网址中,我有:
http://blog.com/cat/post1/index.html
http://blog.com/cat/post2/index.html
http://blog.com/cat/post3/index.html
etc....
.htaccess
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\ /.*/index\.(php|html)\ HTTP
RewriteRule (.*)index\.(php|html)$ /$1 [R=301,L]
当我输入上述网址时,我得到:
http://blog.com/post1/
但我想:
http://blog.com/cat/post1/
我在这里做错了什么???
I am trying to cleanup my URL using mod_rewrite.
In my URLs I have:
http://blog.com/cat/post1/index.html
http://blog.com/cat/post2/index.html
http://blog.com/cat/post3/index.html
etc....
.htaccess
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\ /.*/index\.(php|html)\ HTTP
RewriteRule (.*)index\.(php|html)$ /$1 [R=301,L]
When I enter the URL mentioned above I get:
http://blog.com/post1/
But I want:
http://blog.com/cat/post1/
What am I doing wrong here???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)