mds1256 Posted September 10, 2010 Share Posted September 10, 2010 Hi I currently have my site setup to rewrite .php to null so for example http://mydomain.com/registration actually maps to http://mydomain.com/registration.php But there is nothing to top anyone from typing in http://mydomain.com/registration.php. I want to stop them from doing that so it would come up 404. In essence im trying to hide to the user what language the site is written in Quote Link to comment https://forums.phpfreaks.com/topic/213040-htaccess-to-stop-direct-access-to-php-files/ Share on other sites More sharing options...
corbin Posted September 11, 2010 Share Posted September 11, 2010 Hmmm.... If that were the case, I would just make a custom extension so you could do like page.code or page.c or something. That way if they did find it, no big deal. Another option would be as you said, to just deny direct access to any file (and by "deny" I mean a 404 page). You could probably accomplish that with a clever RewriteCond and a RewriteRule (with the Cond checking if the file exists). Note that you'll need to order your rewrites correctly and mark the one rewriting /registration to /registration.php as final (with [F]). I'm actually kind of curious on this now, so if I decide to mess with it I'll post whatever I use. Quote Link to comment https://forums.phpfreaks.com/topic/213040-htaccess-to-stop-direct-access-to-php-files/#findComment-1110038 Share on other sites More sharing options...
mds1256 Posted September 15, 2010 Author Share Posted September 15, 2010 Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/213040-htaccess-to-stop-direct-access-to-php-files/#findComment-1111304 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.