阻止人们查看网站目录[关闭]

阻止人们查看网站目录[关闭]

问题描述:

Hello all i am having a website in which i have many directories like members/images/emotions and other php files like index.php,login.php,profile.php... etc in the directory/folder images all the imgeas of wbsite is stored and i do not want people to look into it. currenlty when we type www.sitedomain.com index.php is shown which is ok but when we type www.sitedomain.com/images all the images link are shown i dont want any people to look into this folder . a default 404 eror page should be displayed

大家好,我有一个网站,其中有很多目录,如成员/图像/情感和其他php文件,如 index.php,login.php,profile.php ... etc 目录/文件夹中存储wbsite的所有imgeas,我不希望人们查看它。 当我们输入www.sitedomain.com index.php时显示当前没问题,但是当我们输入www.sitedomain.com/images时,显示所有图像链接我不希望任何人查看此文件夹。 应显示默认的404 eror页面 p> div>

You could add a .htaccess file in the folder with the following line in it:

Options -Indexes 

Or (if your site doesn't run on Apache or you don't have override permission)

  • put an empty index.html file in the folder

Or

  • put an index.php file in the folder with the line:

    <?php header('Location: some-other-page.html');

Upload a file called 'index.html' to the directory 'images'. Your server is displaying this message because it is unsure which file is the index file.

Below is a template for your html file:

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>404 Error</title>
</head>
<body>
<p>404 - Page not found</p>
</body>
</html>