Here's my problem: I would like to redirect all requests to a PHP script within a given folder, towards a predetermined page.
Let me explain. In the folder are many PHP scripts that are normally included into the main page; quite common method I'm sure. Openning these pages on there own will just induce errors and may reveal code through the error messages. This may not be a huge security problem as I have no sensitve stuff, but I would still like to be able to do it...
Through guessing and investigation, the solution seems to be to use the mod_rewrite module from within a .htaccess file. Here's what I've got, and it don't work:
I'm not sure if my web hosting gives me access to the mod_rewrite module...
I could also prevent errors from being displayed in PHP, or code the redirect within each individual PHP script, but I feel the .htaccess method is the best.
Cheers,
-D
Let me explain. In the folder are many PHP scripts that are normally included into the main page; quite common method I'm sure. Openning these pages on there own will just induce errors and may reveal code through the error messages. This may not be a huge security problem as I have no sensitve stuff, but I would still like to be able to do it...
Through guessing and investigation, the solution seems to be to use the mod_rewrite module from within a .htaccess file. Here's what I've got, and it don't work:
Code:
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !^.*/foldername/filename\.php.*$ [NC]
RewriteRule .*\.php http://domainname/folder/filename [R,NC]
I'm not sure if my web hosting gives me access to the mod_rewrite module...
I could also prevent errors from being displayed in PHP, or code the redirect within each individual PHP script, but I feel the .htaccess method is the best.
Cheers,
-D