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
Share on other sites

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

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.