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!

4

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.