With Apache's mod_rewrite module I can keep *.php files and load them as
*.html files:
# Make http//example.com/foo/bar.html load /home/site/foo/bar.php
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]
But, is there any elegant way to prevent direct access to
"http//example.com/foo/bar.php"? No matter the "L" flag, all *.html
requests get parsed again with any *.php rule I write, even though the
rewriting does not force a browser redirect and even if I use the NS
flag :-?
I still can restrict it in PHP itself (I can think of checking the value
of $_SERVER['REQUEST_URI']), but I'd like to understand why L and NS do
not work as I expected.
Sorry if this is kinda offtopic but my news server does not provide any
Apache group.
--
-- 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
--
*.html files:
# Make http//example.com/foo/bar.html load /home/site/foo/bar.php
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]
But, is there any elegant way to prevent direct access to
"http//example.com/foo/bar.php"? No matter the "L" flag, all *.html
requests get parsed again with any *.php rule I write, even though the
rewriting does not force a browser redirect and even if I use the NS
flag :-?
I still can restrict it in PHP itself (I can think of checking the value
of $_SERVER['REQUEST_URI']), but I'd like to understand why L and NS do
not work as I expected.
Sorry if this is kinda offtopic but my news server does not provide any
Apache group.
--
-- 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
--
Comment