On 2/2/07, Feris Thia <feris.apache.httpd@xxxxxxxxx> wrote:
Hi Everyone, I configured my .htaccess to map/redirect all my *.html page to *.php pages like below ================================ RewriteEngine on RewriteRule ^([0-9a-zA-Z]+)\.html$ $1.php ================================ It works. But now, I want the client cannot access the php script directly. So I write the rule like these ================================ RewriteCond %{REQUEST_URI} "\.(php)$" RewriteRule .* - [F] ================================ But now it forbid every *.html that maps to my *.php pages... What is wrong ? How can I achieve my goal ?
RewriteRule processing doesn't stop when a rule matches, unless you tell it to. So you first rewrite *.html to *.php and then tell your server to forbid access to *.php, and you get exactly that. First a question: Why do you want to do this? This will cause all kinds of trouble, like when a piece of php generates self referencing urls, that will naturlally end in .php. Forms for example work like this. What you can do however is: - Play with the order of the rules. - Add the [L] flag to stop processing.
Regards, Feris
-- krist.vanbesien@xxxxxxxxx Bremgarten b. Bern, Switzerland -- "...what you don't realize is that in the future Google WILL reach sentience, will [have had] invent[ed] a time machine, and will [have had] travel[ed] back in time to prevent Bill Gates... only to become Bill Gates by accident because of a search engine optimization miscalculation." (Comment on the Dilbert Blog) --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx