编辑.htaccess时错误500


error 500 when editing the .htaccess

我得到错误信息

服务器错误!

服务器遇到内部错误,无法完成您的请求。服务器超载或者CGI脚本出错

如果您认为这是服务器错误,请联系网站管理员。

错误500

这是修改前的代码

AuthName "xampp user"
AuthType Basic
AuthUserFile "C:'xampp'security'xampp.users"
require valid-user

我把它改成了

# 1 ---- Establish a custom 404 File not Found page ----
ErrorDocument 404 /filenotfound.php
# 2 ---- Prevent directory file listing in all of your folders ----
IndexIgnore *

我需要一个自定义的404页面,这样人们就看不到我的文件了

你的。htaccess文件应该是这样的ErrorDocument 404 /404.php for 404 Page Not Found Error

和禁止访问

Options -Indexes

所以你应该用这个

Options -Indexes
ErrorDocument 404 /filenotfound.php

确保将filenotfound.php页放在创建.htaccess文件的文件夹中。