ErrorDocument

Problems with the Windows version of XAMPP, questions, comments, and anything related.

ErrorDocument

Postby dcwateruser » 23. March 2011 18:03

Hi Guys, I'm a new user of XAMPP and I'm running into problems with the ErrorDocument directive. I'm trying to setup a default error page for a virtual site and no matter how many ways I try I keep getting the default apache 404 message "Object not found!". Here is as much detail I can think to provide by each way I have attempted;

1) Using .htaccess file in the root of the virtual site (see below #2) (restarted apache service multiple times to verify)
.htaccess file content;
Code: Select all
ErrorDocument 404 /error.html

httpd.conf file content;
Code: Select all
LoadModule rewrite_module modules/mod_rewrite.so
(so it's enabled)

2) vhosts - tried with and without the local .htaccess, mod_rewrite.so is still enabled (restarted apache service multiple times to verify)
Code: Select all
    <VirtualHost *:80>
        ServerName fleet.xxxx.com
        ServerAlias fleet.yyyy.com
        ServerAdmin myadmin@mydomain.com
        DocumentRoot "C:/xampp/virtualsites/fleet_prod/"
        ErrorLog "logs/fleetprod-error.log"
        CustomLog "logs/fleetprod-access.log" combined
        ErrorDocument 404 /error.html
    </VirtualHost>


3)httpd.conf - uncommented in the inline examples with updated relative path (restarted apache service multiple times to verify)
Code: Select all
ErrorDocument 404 /error.html
dcwateruser
 
Posts: 2
Joined: 23. March 2011 17:39

Re: ErrorDocument

Postby Nobbie » 23. March 2011 18:13

a) where is your error document (full pathname)?

b) did you analyze the error log? Show us the contents.

c) where did you specify the access rights for the DocumentRoot "C:/xampp/virtualsites/fleet_prod/"?
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: ErrorDocument

Postby dcwateruser » 23. March 2011 18:26

Where is error doc:
c:\xampp\virtualsites\fleet_prod\error.html

Site's Error Log;
[Wed Mar 23 12:35:07 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/willie.html
[Wed Mar 23 12:35:07 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico
[Wed Mar 23 12:35:11 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/a
[Wed Mar 23 12:35:11 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico
[Wed Mar 23 12:35:11 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/asdfasdf
[Wed Mar 23 12:35:11 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico
[Wed Mar 23 12:35:12 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/asdfasdf.masd
[Wed Mar 23 12:35:12 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico
[Wed Mar 23 12:35:30 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/asdfasdf.masd
[Wed Mar 23 12:35:30 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico
[Wed Mar 23 12:37:51 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/asdfasdf.masd
[Wed Mar 23 12:37:51 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico
[Wed Mar 23 12:37:51 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/asdfasdf.masd
[Wed Mar 23 12:37:52 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/asdfasdf.masd
[Wed Mar 23 12:37:52 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico
[Wed Mar 23 12:37:52 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/asdfasdf.masd
[Wed Mar 23 12:37:52 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico
[Wed Mar 23 12:37:52 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/asdfasdf.masd
[Wed Mar 23 12:37:52 2011] [error] [client 10.12.96.27] File does not exist: C:/xampp/virtualsites/fleet_prod/favicon.ico

Where Did I specify the rigths?
I didn't, this is XAMPP (xampp-win32-1.7.3.exe) running MS 2008 Server. The site itself is working as expected (small php app) and I'm not running into any other access issues.
dcwateruser
 
Posts: 2
Joined: 23. March 2011 17:39

Re: ErrorDocument

Postby Sharley » 24. March 2011 00:50

dcwateruser wrote: .htaccess file content;
Code: Select all
ErrorDocument 404 /error.html
Remove the leading slash or Apache will look in the \xampp\apache\error folder for error.html which it obviously can't find if it is not in there or give it a full path to the file.


dcwateruser wrote:httpd.conf file content;
Code: Select all
<VirtualHost *:80>
        ServerName fleet.xxxx.com
        ServerAlias fleet.yyyy.com
        ServerAdmin myadmin@mydomain.com
        DocumentRoot "C:/xampp/virtualsites/fleet_prod/"
        ErrorLog "logs/fleetprod-error.log"
        CustomLog "logs/fleetprod-access.log" combined
        ErrorDocument 404 /error.html
    </VirtualHost>
Remove the trailing slash after the fleet_prod and add a Directory Directive to the container to eliminate errors in the log file and to give correct permissions for the VirtualHost DocumentRoot.
Change the path to the error.html file to suit.
Code: Select all
<VirtualHost *:80>
        ServerName fleet.xxxx.com
        ServerAlias fleet.yyyy.com
        ServerAdmin myadmin@mydomain.com
        DocumentRoot "C:/xampp/virtualsites/fleet_prod"
        <Directory "C:/xampp/virtualsites/fleet_prod">
        AllowOverride All
        Order allow,deny
        Allow from all
        </Directory>
        ErrorLog "logs/fleetprod-error.log"
        CustomLog "logs/fleetprod-access.log" combined
        ErrorDocument 404 "C:/xampp/virtualsites/fleet_prod/error.html"
    </VirtualHost>


dcwateruser wrote:httpd.conf
Code: Select all
ErrorDocument 404 /error.html
Again remove the leading slash and specify the full path to the file.

BTW the Apache error files are handled and configured in the \xampp\apache\conf\extra\httpd-multilang-errordoc.conf file and the error files are stored in \xampp\apache\error folder, so it is possible to edit files in this folder using a text editor to give server wide coverage or add your own error.html file in here and change the setting in the conf file above to suit - which may then allow your /error.html code above to work without change.

Also if you comment out this section and then create your own error files in locations you individually specify in the conf files then the server will not give the default server error messages
Code: Select all
# Multi-language error messages
Include "conf/extra/httpd-multilang-errordoc.conf"


Best wishes and good luck. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: hthnightwolf and 65 guests