开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜