0

I experienced a very weird phenomenon! I use an url that is set up like /err/?e=404 for error pages. I also reference them as an ErrorDocument in .htaccess.

I only chose the short version "err", because "error" causes issues! By simply changing "err" to "error", it ceases to work anymore! I get an error 403, but not with my error page, but rather the default error page by apache. This however only seems to apply to my main domain I installed the server with. The other domains don't seem to be influenced by this.

I'm currently testing this using Windows and I get this entry in the error log

AH01276: Cannot serve directory C:/xampp/apache/error/: No matching DirectoryIndex (index.php,index.pl,index.cgi,index.asp,index.shtml,index.html,index.htm,default.php,default.pl,default.cgi,default.asp,default.shtml,default.html,default.htm,home.php,home.pl,home.cgi,home.asp,home.shtml,home.html,home.htm) found, and server-generated directory index forbidden by Options directive

Apparently, /error means something very special to apache2.4 itself. What is it? Why am I not allowed to use this path in htaccess?


On my production system I use

  • Debian 8.3
  • Apache 2.4
  • PHP 5.6.14
bytecode77
  • 14,163
  • 30
  • 110
  • 141
  • check the alias list. There might be an `Alias /error` defined. comment that line. – hjpotter92 Feb 25 '16 at 04:27
  • I didn't find it on the quick, but doesn't this cause errors, too, if I just uncomment it? What's up with this mysterious alias anyway? And why does it only seem to affect the main domain? – bytecode77 Feb 25 '16 at 04:28
  • https://devdocs.io/apache_http_server/mod/mod_alias#alias – hjpotter92 Feb 25 '16 at 06:26
  • Interesting. This would mean I can't use paths like /image or /icons either, right? Never realized that. Any idea how I can accomplish my goal without hacking badly into the apache config is welcome. Otherwise, I'll avoid /error as a rewrite route. – bytecode77 Feb 25 '16 at 06:30
  • You can define routes/paths in a separate VHost config. – hjpotter92 Feb 25 '16 at 06:31
  • But the vHost config is nothing else than what's in `.htaccess`, at least from what I know. And I don't really like the idea of putting code, needed to make my application work, far outside the code base of the application itself. This just seems like very bad practice to me. – bytecode77 Feb 25 '16 at 06:34
  • https://stackoverflow.com/q/6085222/1190388 If you're going to release the code to the public, you can put the vhost config file in a separate directory, and mention about its existence in the readme file. – hjpotter92 Feb 25 '16 at 06:43
  • This project is private. Also I have no performance issues on my server, so I don't want to stray my code all over the place. It makes sense for me to put everything in one place. That's not OCD, but good practice ;) – bytecode77 Feb 25 '16 at 07:03
  • You never showed what you expect Apache to do for the resource /err/ or /error/. The latter seems like a bad idea to take control of on a server where you expect your application to not necesarily be dedicated. – covener Mar 09 '16 at 22:12

0 Answers0