Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_rewrite help

Status
Not open for further replies.

ralphiooo

Programmer
Oct 23, 2005
64
GB
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
 
Hi

And what should happen with the cat-1, subcat-1 and subcat-2 part ? And what did you tried until now, and why that did not worked ?

I am afraid I do not understand your problem, because the answer to your question is in the examples of the mod_rewrite documentation.

Feherke.
 
Hi, I worked it out now my regular expressions really are rubbish but i put something together that seems to be working. Cheers anywayz.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top