开发者

.htaccess can not/will not access /error/ directory

I'm trying to setup custom error pages.

I put the pages in /error/ in the document root. However, I think this may have a conflict as .htaccess can not access the file I specified.

I did set AllowOverride All in my apache config file.

If I go to /error/, a 403 error appears.

I can confirm that my .htaccess is being read, because if I enter some random text into the .htaccess, it will return a internal server error.

rewriting is enabled.

Here is my .htaccess

Options +FollowSymlinks
RewriteEngine On
RewriteBase /

<Files .htaccess> 
order开发者_如何学Go allow,deny 
deny from all 
</Files> 

ErrorDocument 404 /error/noexist.html

If I put the error page in the document root and set it in the htaccess, it will read fine.

The problem is that it can't read the contents of the /error/ directory.


/error/ is a directory, right? The default Apache configuration is to return a 403 Forbidden status when trying to access the root of a directory that does not contain an index page unless Options +Indexes is set, which will cause the server to automatically generate and show a list of files and subdirectories.

If you want the error page to show in this case, you could try adding the same ErrorDocument line with 404 changed to 403.


Did you set directory permissions?

<Directory "C:/path/to/htdocs/error">
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

I think this requires access to Apache's httpd.conf, though. Do you have access to that?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜