2016-01-30 50 views
1

我的网站托管于GoDaddy。我想利用浏览器缓存,所以我添加了一个htaccess文件。当向网站添加.htaccess 500服务器时出错

当我这样做时,我的网站返回500错误。我删除了htaccess文件,我的网站恢复正常。我错过了什么?这里是我的htaccess文件:

//Custom 404 errors 
ErrorDocument 404 404.php 

//Change default directory page 
DirectoryIndex index.php 

//Prevent viewing of .htaccess file 
<Files .htaccess> 
    order allow,deny 
    deny from all 
</Files> 

//Prevent directory listings 
Options All -Indexes 

在此先感谢

+0

可以显示服务器日志中的错误消息吗? – Gavriel

+1

如上所述,检查你的日志(总是!!当处理500错误时),但我在这里看到的可疑是使用'404.php'而不是'/ 404.php'。我认为'ErrorDocument'预计以/ –

+0

开头的网络路径我去了GoDaddy,并且打开错误日志的功能不存在,因为我的客户端没有为该功能付费。噢。感谢您的帮助 – BoundForGlory

回答

3

这是确切的htaccess文件?

  1. 你必须与#代替//
  2. 变化ErrorDocument 404 404.phpErrorDocument 404 /404.php

那么,如果问题仍然存在,显示评论,试试这个太:

  • 更改Options All -IndexesIndexIgnore
  • +0

    我甚至没有注意到这些评论。 –

    +1

    问题是评论和选项所有索引...我将其更改为选项 - 索引...它工作正常,我还添加杠杆浏览器缓存以及....谢谢 – BoundForGlory

    相关问题