开发者

Cleaning URL using mod_rewrite

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜