I am rewriting all of the messy URL's on my site and I am having trouble rewriting URL's with pagination queries added to them.
I would like to do 1 rewrite rule for all pagination URL's (jobs and blogs) but as of right now I am only worried about getting it working.
The initial pagination query looks like this:
blog.php?page=2 OR
opportunities.php?page=2 I would LIKE them to look like this
/blog/page/2 AND
opportunities/page/2 but everything I've tried doesn't seem to work... The Rewrites WORK when I make them look like
/blog-page/2 AND
/opportunities-page/2 but I would like them to have a slash rather than a dash.
Here are ALL my current rewrites... the ones that need work are at the bottom. (blog pagination and opportunities pagination)
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
# Full path to your site
RewriteBase /
# Rewrite all php files
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# Rewrite the user profile pages
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^user/([a-zA-Z0-9_-]+)$ profile.php?user=$1
RewriteRule ^user/([a-zA-Z0-9_-]+)/$ profile.php?user=$1
# Rewrite the company profile pages
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^company/([a-zA-Z0-9_-]+)$ employer.php?user=$1
RewriteRule ^company/([a-zA-Z0-9_-]+)/$ employer.php?user=$1
# Rewrite the blog post pages
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^post/([a-zA-Z0-9_-]+)$ entry.php?id=$1
RewriteRule ^post/([a-zA-Z0-9_-]+)/$ entry.php?id=$1
# Rewrite the job listing pages
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^job/([a-zA-Z0-9_-]+)$ listing.php?id=$1
RewriteRule ^job/([a-zA-Z0-9_-]+)/$ listing.php?id=$1
# Rewrite the blog category queries
RewriteRule ^/category/(.*)/?$ /$.php?cat=$1 [QSA]
RewriteRule ^sort/(.*)/?$ /$.php?sort=$1 [QSA]
# Rewrite blog pagination
RewriteCond %{REQUEST_URI} !blog\.php [NC]
RewriteRule ^blog/page/([0-9]+)$ blog.php?page=$1
RewriteRule ^blog/page/([0-9]+)/$ blog.php?page=$1
# Rewrite opportunity pagination
RewriteCond %{REQUEST_URI} !opportunities\.php [NC]
RewriteRule ^opportunities/page/([0-9]+)$ opportunities.php?page=$1
RewriteRule ^opportunities/page/([0-9]+)/$ opportunities.php?page=$1
</IfModule>