I’ve done this htaccess file with a few rewrite rules, but problem is, i’m able to access individual .php files on the server as well a directly access sections like domain.com/admin/change_profile.php
Is this normal? I thought this was not supposed to happen. How do I do this htaccess file so that only if a rule is fulfilled it’ll take me to that folder? In short: disallow direct access to domain.com/admin/change_profile.php or domain.com/admin/ or anything else.
RewriteEngine on
RewriteRule ^/?(us|uk|eu)/?$ test.php [NC,L] #Country
RewriteRule ^/?(us|uk|eu)/(profile)/([a-zA-z0-9]+)/?$ test.php [NC,L] #Country - Profile
Here:
http://localhost/us -> Works
http://localhost/us/profile/companyname -> Works
http://localhost/admin -> Works too! But admin is not in the set of rules above. admin is a folder inside htdocs.
Http://localhost/admin should not have worked since its not part of (us|uk|eu) rule. Note: Its a folder with php files inside htdocs. How is this happening and how to overcome it?
Thanks