php - Deny script from client, but use locally -
i have .htaccess file - looks this:
rewriteengine on <filesmatch ^.*\.php.*$> order allow,deny deny satisfy </filesmatch> rewriterule ^help$ scripts/help.php [l] #more rewrites here...
what i'd able allow url such http://example.com/help
rewritten (as per rule there) , handled help.php script in scripts directory, @ same time, deny people directly running script using http://example.com/scripts/help.php
. problem is, when use these statements, both urls return 403 forbidden. i'm not sure if i'm trying possible...
unfortunately, cannot place files outside/above of root web directory (which why i'm asking this), nor have access httpd.conf file.
if /help
requested, gets rewritten /scripts/help.php
internally fulfills pattern of <filesmatch>
. that’s why access /help
forbidden.
but can use mod_rewrite forbid access /scripts/help.php
if requested directly checking request line:
rewritecond %{the_request} ^[a-z]+\ /[^?\ ]*\.php[/? \] rewriterule .*\.php.*$ - [f]
here ^[a-z]+\ /[^?\ ]*\.php[/? \]
tests whether there .php
in requested uri path (it might preceded character except ?
, space) , either followed /
(path segment separator), ?
(indicator uri query) or space (end of uri).
Comments
Post a Comment