changing default Error 404 page

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

changing default Error 404 page

Postby devaparvata » 14. May 2009 07:51

Hello there. I've been using XAMPP in somewhat production environment. As a result of the requests for non-existent webpages on the server the default Error 404 page is called and as you all know it reveals the exact version numbers of apache, mysql, php etc. Obviously, I do not want to show them off. How can I change custom Error 404 page? Especially I intend to make the server signature off.
devaparvata
 
Posts: 2
Joined: 14. May 2009 07:42

Re: changing default Error 404 page

Postby devaparvata » 14. May 2009 12:42

I've found the solution. I've been using XAMPP for Linux 1.7.1.

Code: Select all
sudo pico /opt/lampp/etc/extra/httpd-multilang-errordoc.conf


at the end of the file, change the lines as shown i.e. put # to the begginning and add new lines.

ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
#ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
#ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 404 /error403.html
ErrorDocument 404 /error404.html
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

Save and exit (Ctrl+O, CTRL+X)

Prepare custom error files named error403.html and error403.html. These files should be kept in opt/lampp/htdocs directory

It's OK. Just restart XAMPP by below code.

Code: Select all
sudo /opt/lampp/lampp restart


One more thing, let's think about XAMPP's new security setting of preventing access to XAMPP and phpmyadmin directories rather than the permitted IP addresses. This setting shows error 403 page if you do not connect from permitted IP's. To change this setting also:

Code: Select all
sudo pico /opt/lammp/etc/extra/httpd-xampp.conf


Thus,

change the line below in /opt/lammp/etc/extra/httpd-xampp.conf

Code: Select all
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var


as

Code: Select all
ErrorDocument 403 /error404.html


It is not a mistake. Intentionally I recommend you to direct unauthorized visitors requesting to access xampp and phpmyadmin directories to the "page not found" (404) error page. This will be slightly more secure since the attacker may think that there is no xampp or phpmyadmin directory in the server.

I reply my question, i hope this helps.
devaparvata
 
Posts: 2
Joined: 14. May 2009 07:42

Re: changing default Error 404 page

Postby Wiedmann » 14. May 2009 14:09

This will be slightly more secure since the attacker may think that there is no xampp or phpmyadmin directory in the server.

You are right. It's just we need a way to explain existing users, why they (suddenly) don't have access to this dirs, like with older XAMPPs.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 3 guests