开发者

.htaccess how can i allow access to pages only through the index.php page

开发者 https://www.devze.com 2023-03-09 08:52 出处:网络
In my folder i have index.php user.php h开发者_开发技巧eader.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

In my folder i have

index.php user.php h开发者_开发技巧eader.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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消