using .htaccess to redirect from friendly url to actual file

Posted by Kohalza on Stack Overflow See other posts from Stack Overflow or by Kohalza
Published on 2010-06-01T20:56:40Z Indexed on 2010/06/02 0:53 UTC
Read the original article Hit count: 267

I have the following RewriteRule in my .htaccess to redirect from a friendly url to my main application file:

RewriteRule ^\/(.*).html$ home/www/page.php?p=$1 [L]

This should send any url that points to a html page to page.php with the url as a parameter that will be parsed by the app. This works for urls that look like http://www.example.com/hello.html

The problem is that I get a 404 error when the url contains a directory path, for example: http://www.example.com/category/hello.html

The error reads: "File does not exist: /home/www/category"

Seems it is first looking for the 'category' path instead of processing the .htaccess Any ideas how to solve this?

© Stack Overflow or respective owner

Related posts about apache

Related posts about .htaccess