最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

url rewriting - Change pagination url format

programmeradmin1浏览0评论

I have a URL like this:

example/blog/page/5

I want to change it to:

example/blog/page-5

I tried using a RewriteRule like this:

RewriteRule ^blog/page-([0-9]+) /blog/page/$1

but this returns 404 page not found. After a lot of debugging I realized that the reason it returns 404 is that the $_SERVER['REQUEST_URI'] in PHP stays blog/page-5 even after Apache rewrites it to blog/page/5.

It is possible to do it with redirection by adding [R] at the end of the RewriteRule but it will change the URL in browser to /blog/page/5, and I don't want that.

Any ideas?

发布评论

评论列表(0)

  1. 暂无评论