View Full Version : Weird htaccess rewrite problem

03-24-2010, 10:51 AM
I've taken over management of a corporate website, and it has built in RewriteRules to display products.

So http://www.mywebsite.com/product-1 displays product 1, however the page "product-1" doesn't actually exist.

On top of this, if I went to http://www.mywebsite.com/whateveriput/product-1, the product 1 page would STILL be displayed.

And on top of this, if I put in a fictional page after the domain, such as http://www.mywebsite.com/testing123455, it does not return a 404, instead it displays a page called "products.php" ....

I've had a look at the htaccess and this is whats in it :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ products.php?$1 [L]

Now, I'm no htaccess expert, but this rule seems a BIT open ended! i.e ANYTHING, that isnt a file or a directory gets rewritten via products.php? Is this right? What could I do to make it less open ended?

Anyway, so I delete this htaccess, and now my products don't work with their rewritten URLS (obviously). So to access them, I would think that all you would have to do is type :


and the product would be displayed? However it doesn't...

So how do I find out how to get to my products without the htaccess? I am well confuzzled...


03-25-2010, 03:03 AM
have you tryed just putting products.php?1 it may not be right but its worth a shot because products- could be equal to products.php and the 1 could equal ?1

and seeing as its a corporate website you would have thought they would have put some sort of 404 error system in and also denyed access to product 1 if its looking like its inside a dir.