Jump to content

Recommended Posts

Hi, i'm useless at regular expressions and having trouble implement mod_rewrite to make my site search engine friendly. The url I want to rewrite is:

 

/products/index.php?category_id=$cid(&page=$page)?

 

to:

 

/products/[a-zA-Z0-9-/]*/([0-9]+)$/? (something like this - i've read alot of tutorials but can't get my head around it)

 

eg

 

/products/cat-1/subcat-1/subcat-2/12/ or

/products/cat-1/subcat-1/subcat-2/12 (with or without the ending slash) or

/products/cat-1/subcat-1/subcat-2/12/1 (including the page number - again with or without the ending slash)

 

note: the 12 is the category_id and the 1 is the page

 

and:

 

/products/product.php?product_id=$pid

 

to:

 

/products/cat-1/subcat-1/subcat-2/product-name/19 (again with or without the ending slash)

 

note: the 19 is the product_id.

 

Would appreciate it if someone could help. Thanks

Link to comment
https://forums.phpfreaks.com/topic/3116-mod-rewrite-help/
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.