我无法隐藏访客的php核心文件

我无法隐藏访客的php核心文件

问题描述:

Right now im using .htaccess to hide certain folders from being viewed by visitors using

"Options -Indexes"

If I user types www.mysite.com/foldername/ a error page gets displayed which I want, but how can I make sure users cant see the files themself in those folders?

Eg: www.mysite.com/ajax/file.php show if the user types that in, but www.mysite.com/ajax/ will show a error page.

How can I make sure users cant view single files in folders? I have a few files in my ajax folder and also my /functions/ folder that I dont want users being able to see

Thanks in advance

现在我正在使用.htaccess来隐藏访问者使用 p> 查看某些文件夹

“选项 - 索引” p>

如果我的用户输入www.mysite.com/foldername/,会显示我想要的错误页面,但如何确保用户无法看到 将自己归档到这些文件夹中? p>

例如:www.mysite.com/ajax/file.php显示用户是否输入了该文件夹,但www.mysite.com/ajax/将显示 错误页面。 p>

如何确保用户无法查看文件夹中的单个文件? 我的ajax文件夹中有一些文件,还有我希望用户无法看到的/ functions /文件夹 p>

提前致谢 p> div>

Usually files you dont want people to see would be keep out of your public folder.

like this:

-root
--public_html
---index.php
--application (secret)
---somefile.php

You would then include them in index.php like this:

require('../application/somefile.php');

But the content of your php isnt visible to visitors and if used with ajax, they have to be accessible via the browser.

If you dont want people to get a list of files in a folder, you can put in an index.php to prevent it.