1

In my folder i have

index.php user.php header.php writer.php footer.php

i want the user to access index.php only and links to the other .php pages are in index.php

if user enters header.php in address bar he get forbidden error.

Thanks

1 Answer 1

3

Remove those files from the Root folder. and place them in a folder not accessible to the user.

index.php stays in the root.

example: html is the root folder accessed by http://example.com

/var/www/html/index.php

and the other files go in a seperate directory not accessible through the url.

Example:

/var/www/includes/user.php
/var/www/includes/header.php
...

you can access those files with the include going back one directory. Example

index.php
<?php

include '../includes/users.php';

?>

This will make your website more secure.

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.