Jump to content

[SOLVED] url mod rewrite


poe

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/80691-solved-url-mod-rewrite/
Share on other sites

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.