Re: Using Apache's mod_rewrite to hide scripts extension
- From: "Álvaro G. Vicario" <alvaroNOSPAMTHANKS@xxxxxxxxxxxxxx>
- Date: Wed, 30 Apr 2008 09:18:05 +0200
Tim Roberts escribió:
RewriteEngine On
RewriteRule ^(.*)\.php$ $1.php [R=404,L]
RewriteRule ^(.*)\.html$ $1.php [L]
That says PHP references should redirect to a 404, and HTML references
should be rewritten to PHP.
It doesn't work either because when I request foo.html I'm silently redirected to foo.php, rewriting starts again and first rule generates a Not Found status code.
Thank you for your suggestion but it's really tricky!
I've asked my newsmaster if I can get "alt.apache.configuration" added to the groups lists (Google Groups is okay but it does not allow e-mail obfuscation) but I guess I'll implement this as is and I just won't care about direct access to *.php files (or I'll check $_SERVER['REQUEST_URI'] and generate the 404 status in PHP). Your comparison of mod_write with Sendmail has scared me to the bone ;-)
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
.
- Follow-Ups:
- Re: Using Apache's mod_rewrite to hide scripts extension
- From: Guillaume
- Re: Using Apache's mod_rewrite to hide scripts extension
- References:
- Using Apache's mod_rewrite to hide scripts extension
- From: "Álvaro G. Vicario"
- Re: Using Apache's mod_rewrite to hide scripts extension
- From: Jerry Stuckle
- Re: Using Apache's mod_rewrite to hide scripts extension
- From: "Álvaro G. Vicario"
- Re: Using Apache's mod_rewrite to hide scripts extension
- From: Jerry Stuckle
- Re: Using Apache's mod_rewrite to hide scripts extension
- From: Tim Roberts
- Using Apache's mod_rewrite to hide scripts extension
- Prev by Date: Re: Using Apache's mod_rewrite to hide scripts extension
- Next by Date: Re: I couldn't understand why PHP is so popular. The PHP code looks so horrible compared with Java.
- Previous by thread: Re: Using Apache's mod_rewrite to hide scripts extension
- Next by thread: Re: Using Apache's mod_rewrite to hide scripts extension
- Index(es):
Relevant Pages
|