开发者

Pagination and .htaccess

I am currently showing results u开发者_开发知识库sing the following url index.php?id=1 and using .htaccess to rewrite it like cat/sub-cat/ and i am using pagination and the url to the next page is index.php?page=2 etc but i can't seem to get the pagination to work with my .htaccess rewritten url so for example threads/thread-name/ shows the page fine etc but when i click on the next page link i just get the same page, if i use the normal url such as index.php?id=1&page=2 that works fine but i can't seem to get it to work in a nicer fashion

Hope that explains the issue clearly :)


If I understand your problem correctly, then you need a rewriterule something like this:

RewriteRule ([a-zA-Z_-]+)/([0-9]?) index.php?id=$1&page=$2

Which then directs /mycoolpage/2 to index.php?id=mycoolpage&page=2 etc

And if the last number is not present, then the page query parameter will simply be blank (so you'd assume page=1)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜