Apache htaccess Custom ErrorDocument not working properly for root home page 403 Error Issue and Solution

So I have a domain "testdomain.com".

Inside test domain.com's root is the following .htaccess:

Options +FollowSymLinks -Indexes
ErrorDocument 403 /launch/index.html

Order Deny,Allow
Deny From All
Allow From

When you visit anything other than root things work fine. Eg. if you visit http://testdomain.com/somedirfile.html

It will show the right error in /launch/

But if you just visit the root you get the standard Apache Test page even though a 403 is returned. The reason for this is because of an Alias "Error" in /etc/httpd/httpd.conf

Find this line and comment it out:

Alias /error/ "/var/www/error/"

What happens when visiting root is that it checks for a custom 403 error in /var/www/error/ and when it doesn't find one in there it returns noindex.html (the Apache test page).

However I don't know a better work-around what Apache then does after commenting out that alias is it insists in then looking inside your /www/document_root/error/ folder for a matching custom file. If not it looks for a noindex.html in there.

So all I did was create a no index.html in an error folder within my document root.

This solves the issue but I am not sure of how to make a better solution. Isearched for hours modifying the vhost configuration but nothing worked or helped except the above.

These URLs below had the same issue:


Here is some of the troubleshooting process I went through:

I have an issue where I am only allowing a few IPs to view a website in .htaccess:

Options +FollowSymLinks -Indexes
ErrorDocument 403 /launch/index.html

Order Deny,Allow
Deny From All
Allow From

# Now it works if you go to http://url/somecrap it will take you to /launch/index.html
But if you just go to the reoot http://url/ or http://url you get the Apache Test page instead:


edit /etc/httpd/httpd.conf

# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html

# Putting this all together, we can internationalize error responses.
# We use Alias to redirect any /error/HTTP_.html.var response to
# our collection of by-error message multi-language collections. We use
# includes to substitute the appropriate text.
# You can modify the messages' appearance without changing any of the
# default HTTP_.html.var files by adding the line:
# Alias /error/include/ "/your/include/path/"
# which allows you to create your own set of files by starting with the
# /var/www/error/include/ files and
# copying them to /your/include/path/, even on a per-VirtualHost basis.

#Alias /error/ "/var/www/error/"

[root@serverdev error]# mv noindex.html noindex.html-bad
[root@serverdev error]# readlink -f .

Alias /error/ "/var/www/error/"

#Alias /error/ "/var/www/error/"

AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en es de fr
ForceLanguagePriority Prefer Fallback

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

[Sun Apr 08 04:09:43 2018] [error] [client] client denied by server configuration: /www/vhosts/vhosttest.com/httpdocs/
[Sun Apr 08 04:09:43 2018] [error] [client] client denied by server configuration: /www/vhosts/vhosttest.com/httpdocs/error


apache, htaccess, custom, errordocument, solutionso, domain, quot, testdomain, followsymlinks, indexes, index, html, eg, http, somedirfile, alias, etc, httpd, conf, var, www, doesn, returns, noindex, commenting, insists, document_root, folder, matching, solves, searched, modifying, vhost, configuration, urls, https, linuxquestions, org, linux, server, serves, forbidden, ips, troubleshooting, allowing, website, url, somecrap, reoot, edit, customizable, responses, flavors, text, redirects, external, examples, cgi, bin, missing_handler, pl, subscription_info, internationalize, redirect, http_, multi, collections, includes, substitute, modify, default, adding, allows, copying, virtualhost, serverdev, mv, readlink, ifmodule, mod_negotiation, mod_include, directory, allowoverride, includesnoexec, addoutputfilter, addhandler, languagepriority, en, es, fr, forcelanguagepriority, fallback, additionally, encountered, apr, vhosts, vhosttest, httpdocs,

Latest Articles

  • Centos 7 how to save iptables rules like Centos 6
  • nfs tuning maximum amount of connections
  • qemu-kvm error "Could not initialize SDL(No available video device) - exiting"
  • Centos 7 tftpd will not work with selinux enabled
  • Debian Ubuntu Mint Howto Create Bridge (br0)
  • How To Control Interface that dhcpd server listens to on Debian based Linux like Mint and Ubuntu
  • LUKS unable to type password to unlock during boot on Debian, Ubuntu and Mint
  • Debian Ubuntu and Linux Mint Broken Kernel After Date - New Extra Module Naming Convention
  • Wordpress overwrites and wipes out custom htaccess rules and changes soluton
  • Apache htaccess and mod_rewrite how to redirect and force all URLs and visitors to the SSL / HTTPS version
  • python 3 pip cannot install mysql module
  • QEMU-KVM won't boot Windows 2016 or 2019 server on an Intel Core i3
  • Virtualbox vbox not starting
  • Bind / named not responding to queries solution
  • Linux Mint How To Set Desktop Background Image From Bash Prompt CLI
  • ImageMagick Convert PDF Not Authorized
  • ImageMagick Converted PDF to JPEG some files have a black background solution
  • Linux Mint Mate Customize the Lock screen messages and hide username and real name
  • Ubuntu/Gnome/Mint/Centos How To Take a partial screenshot
  • ssh how to verify your host key / avoid MIM attacks