trying to work on a little mod_rewrite functionality and I am hitting a road block.
www.samplesite.com/index.php is the main index file.
in the htaccess I would like to have something like the below so that if someone specifies www.samplesite.com/sample-product-1 it will evaluate and call the itemdetail script with the right product name which I then translate into an ID and pull from the db.
RewriteRule ^products/([^/\.]+)/?$ itemdetail.php?name=$1 [L]
However when I do that, I end up with issues with the style sheet and other referenced files not being found in the products directory. IF you view source it does not show you that its pulling from products, but if you click on the link in view source, it is referenced there.
So I took the products out and tried to have just
RewriteRule ([^/\.]+)/?$ itemdetail.php?name=$1 [L]
This obviously causes problems as it is always going to call the itemdetail script. How do you tell it to stay on index if nothing is passed?
Thanks
|