开发者

Cleaning URL using mod_rewrite

开发者 https://www.devze.com 2023-01-30 05:26 出处:网络
I am trying to cleanup my URL using mod_rewrite. In my URLs I have: http://blog.com/cat/post1/index.开发者_高级运维html

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???


RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\ /.*/index\.(php|html)\ HTTP
RewriteRule (.*) http://blog.com/cat/$1 [R=301, L]
0

精彩评论

暂无评论...
验证码 换一张
取 消