Jump to content

help with htaccess and multipie vars


Alechko

Recommended Posts

Hello folks,

I need a little help with rewriterules in htaccess.

 

I have those files:

product.php?id=*1* (numeric)

vendor.php?name=*HP* (string)

cat.php?id=*141* (numeric)

 

I Rewrited something like that:

 

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^(.+)/$ vendor.php?name=$1

 

that it will be:

domain.com/HP/

 

And I'm stuck.. because I don't have any clue how to Rewrite it to the final result:

domain.com/HP/CatID/ProductID/

 

Thanks..

 

 

Link to comment
https://forums.phpfreaks.com/topic/265814-help-with-htaccess-and-multipie-vars/
Share on other sites

If you have 3 different scripts I would think you would want 3 different rules for example:

 

RewriteRule ^vendor/(.+)$ vendor.php?name=$1
RewriteRule ^category/([0-9]+)$ cat.php?id=$1
RewriteRule ^product/([0-9]+)$ product.php?id=$1

 

Otherwise you may be better off passing the url to a php script to parse out using its regex engine.

 

RewriteRule ^(.+)$ parse.php?url=$1

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.