poe Posted December 7, 2007 Share Posted December 7, 2007 i have this url: for page 1: localhost/mod_category/cat_name/ OR for pages 2, 3, 4, 5 ... localhost/mod_category/cat_name/page_2.html where: cat_name can be any of my category names and there can be any number of pages and the page_1 url does not show page_1. (example link #1) if i put in my htaccess file: ##Category Page Rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule (.*)mod_category/([^/]+)/page_(.*)\.htm[l]?$ mod_category.php [L] i cant seem to get it to work. it seems to work when i have a url like: localhost/mod_category/cat_name/page_2.html but when i use the url that does not show the page number it doesnt work. localhost/mod_category/cat_name/ thanks chris Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 9, 2007 Share Posted December 9, 2007 You will have to provide separate rewrite rules for the different urls with or without the page number, eg: RewriteRule (.*)mod_category/([^/]+)$ mod_category.php RewriteRule (.*)mod_category/([^/]+)/page_(.*)\.htm[l]?$ mod_category.php [L] Quote Link to comment Share on other sites More sharing options...
poe Posted December 10, 2007 Author Share Posted December 10, 2007 thanks... one more thing. how could i write this to accept either a trailing / or no / localhost/mod_category/cat_name/ localhost/mod_category/cat_name RewriteRule (.*)mod_category/([^/]+)$ mod_category.php Quote Link to comment Share on other sites More sharing options...
poe Posted December 10, 2007 Author Share Posted December 10, 2007 oh... i think i got it! RewriteRule (.*)mod_category/([^/]+)/?$ mod_category.php [L] i guess the /? allows to except with or without a trailing / Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.