conware
07-28-2011, 02:19 PM
Hi guys I made news blog with pagination.
Yesterday I decided i wanted to rewrite the urls to make them cleaner.
Now my normal url looks like this:
site.com/blog.php?id=10&start=0
Note the start is for the pagination.
So I rewrote it to this:
site.com/blog/10/post_title/paging-0
This worked however sometimes the pagination is not included.
How should I modify the htaccess to also display the page when start is not set?
For example: site.com/blog.php?id=10
should become: site.com/blog/10/post_title/
My code so far:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^blog/([0-9]+)/[^/]+\/?paging-([0-9]?)$ blog.php?id=$1&start=$2 [L]
RewriteRule ^blog/?$ blog.php [L]
</IfModule>
Yesterday I decided i wanted to rewrite the urls to make them cleaner.
Now my normal url looks like this:
site.com/blog.php?id=10&start=0
Note the start is for the pagination.
So I rewrote it to this:
site.com/blog/10/post_title/paging-0
This worked however sometimes the pagination is not included.
How should I modify the htaccess to also display the page when start is not set?
For example: site.com/blog.php?id=10
should become: site.com/blog/10/post_title/
My code so far:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^blog/([0-9]+)/[^/]+\/?paging-([0-9]?)$ blog.php?id=$1&start=$2 [L]
RewriteRule ^blog/?$ blog.php [L]
</IfModule>