0

I know direct URL access can be prevented via .htaccess rules but I don't know much about meta-chars or escaping.

these are the files in my xammp/htdocs folder, accessed using localhost:

index.php
createScheme.php
several someother.php

I want direct access to be enabled only for index.php and createScheme.php and all others pages should be blocked against direct access.

Please help!

Sapnesh Naik
  • 11,011
  • 7
  • 63
  • 98

1 Answers1

2

This .htaccess file will only allow users to open index.php. Attempts to access any other files will result in a 403-error.

Order deny,allow
Deny from all

<Files "index.php">
    Allow from all
</Files>

If you also want to use authentication for some of the files, you may simply add the content from your current file at the end of my example.

Rohit Goyani
  • 1,246
  • 11
  • 26