Hi All, this is killing me and I was wondering if anybody knew how to fix this. What I need to do is mod_rewite URLs to mimich directories for variables. Easy, but what I need is to be able to handle the absence of some pseudo directories in the URL and assume that the value is null if that directory doesn't exist. From what I hear, I need to create multiple rules. Seems easy, so this is the code:
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^cart/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ cart/index.php?Car_Truck=$1&Description=$2&Manufacturer=$3&Make=$4&Model=$5&start=$6&product_id=7
RewriteRule ^cart/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ cart/index.php?Car_Truck=$1&Description=$2&Manufacturer=$3&Make=$4&Model=$5&start=$6
RewriteRule ^cart/(.*)/(.*)/(.*)/(.*)/(.*)$ cart/index.php?Car_Truck=$1&Description=$2&Manufacturer=$3&Make=$4&Model=$5
RewriteRule ^cart/(.*)/(.*)/(.*)/(.*)$ cart/index.php?Car_Truck=$1&Description=$2&Manufacturer=$3&Make=$4
RewriteRule ^cart/(.*)/(.*)/(.*)$ cart/index.php?Car_Truck=$1&Description=$2&Manufacturer=$3
RewriteRule ^cart/(.*)/(.*)$ cart/index.php?Car_Truck=$1&Description=$2
RewriteRule ^cart/(.*)$ cart/index.php?Car_Truck=$1
Unfortunately I lose all variables, but there are no 404 errors for the various URLs I would use.
I am able to make it work this this:
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^cart/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ cart/index.php?Car_Truck=$1&Description=$2&Manufacturer=$3&Make=$4&Model=$5&start=$6&product_id=7
by specifying the directory as 0, but the resulting URLs are not as clean. then I would have to specify URLs like this doimain.com/cart/car/0/0/0/0/0/0/
instead of doimain.com/cart/car/
any ideas what I am doing wrong here?