views:

62

answers:

1

I've modified my .htaccess file to have the following statement

RewriteCond $1 !^index.php$
RewriteRule ^/?([^/]+)$ index.php?c=home&m=details&seo=$1 [L,NS]

This allows me to use product URL's like this: http://domain.com/product_name

However, when trying to access a file at the same level as index.php, it always calls the RewriteRule above and errors out.

I need to be able to access files like below, but each URL currently attempts to load index.php. http://domain.com/about.htm
http://domain.com/terms.htm
http://domain.com/robots.txt
etc

Any suggestions on how I can modify my htaccess file to get this to work correctly?

+3  A: 

If you want files to trump products you could toss in another condition:

RewriteCond $1 !^index.php$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?([^/]+)$ index.php?c=home&m=details&seo=$1 [L,NS]

...meaning that only if the requested URI doesn't map to a file should it be treated as a product.

Having files trump products like this isn't terrible unless you plan on having products with names like "something.html" and "dynamic.php" or "lenna.jpg".

LeguRi
Very Nice! That seems to work! Are there any performance issues with doing it this way since it needs to check for a file each time when loading a product?
mike
That I wouldn't know :(
LeguRi