Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite help needed to clean up pagination

Please help a Mod_Rewrite newbie...

         

brashquido

11:21 pm on Oct 30, 2007 (gmt 0)

10+ Year Member



Hi All,

Having a bit of an issue trying to come up with rules to clean up the way the paging is displayed on my site. I have paging at the category level and also paging within articles themselves, and both are generated differently. Below are the rules I am working with currently which I am looking to extend and/or add to so that I get a clean URL structure across my site.


RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

With the above rules these are the results I get when people are browsing the second page at the category level;

URL in browser

http://example.com/category?page=1

I am wanting the URL to look like this;
http://example.com/category/page_1

This is what the request looks like in the log file;
URI-Stem
index.php

URI-Query
 q=category&page=1

When people are browsing multipage articles the URL of the second page looks like this;

URL in browser

http://example.com/category/article?page=0%2C1

I'm wanting the URL to look like this;
http://example.com/category/article/page_1

This is what the request looks like in the log file;
URI-Stem
index.php

URI-Query
 q=category/article&page=0%2C1

Hopefully someone can help me as I'm struggling to create the rules to get all this working at the moment.

jdMorgan

12:50 am on Oct 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This thread, Changing Dynamic URLs to Static URLs [webmasterworld.com], should help you get started.

Jim