Where's the 404 error page to be found?

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

Where's the 404 error page to be found?

Postby JoepC » 14. November 2008 05:40

Hi guys,

My first post here and I'm a complete newbie, so bear with me.

I installed XAMPP stand alone on my desktop (Windows Vista Home Premium / D:\xampp), together with Joomla! (D:/xampp/htdocs/joomla15) so I can start building a website that's eventually going to run on a server somewhere else.

I use my HOSTS file for blocking advertisements and malware.

To be able to work with XAMPP and Joomla! I did a few things:

- added two lines to HOSTS
127.0.0.1 localhost (was already in there)
127.0.0.1 loc
127.0.0.1 joomla15.loc

- created two virtual servers in httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/joomla15"
ServerName joomla15.loc
</VirtualHost>

(Virtual hosts is included in httpd.conf:
Include conf/extra/httpd-vhosts.conf)

Now where before I just got a blank page (or one or more blank frames on a page) whenever I hit one of the no go websites in HOSTS, now I get a page with a long text (it's in Dutch, but you'll get the gist of it - '404 page not found', I guess)

"Object niet gevonden!

De gevraagde URL was niet gevonden op deze server. De link op deze pagina pagina is verkeerd of achterhaald. Gelieve de auteur van die pagina in te lichten over deze fout.

Indien u van oordeel bent dat deze server in fout is, gelieve de webmaster te contacteren."

Now I would like to go back to the blank page I got so far (unless of course there is a 'real' 404 error), but I can't find where that error message is coming from! I searched the whole XAMPP folder, contents of files and all, but to no avail. So my guess would be it's some record somewhere in the mySQL database.

Anyway, I don't want to go too deep into the technicalities of php, mySQL or apache (I just want to get going with Joomla!), but this little bug would be nice to get rid of.

So, does anyone have any suggestions what to do?

Bucabay posted about this in his blog but that is not detailed enough for me to make head or tails of nor tailored to XAMPP.

Any help would be much appreciated.

Joep

PS: I use Firefox (v3.0.3)
User avatar
JoepC
 
Posts: 2
Joined: 14. November 2008 05:14
Location: Golden, CO USA

Postby Sharley » 14. November 2008 07:06

The Apache error message file system is seemingly both complex and hard to find as you say.

The contents of apache\error has all the languages and variables, the html template pages are in the apache\error\include\ folder and the associated configuration file is in apache\conf\extra\httpd-multilang-errordoc.conf

In the conf file are some instructions and a LanguagePriority setting that in mine is:
en cs de es fr it ja ko nl pl pt-br ro sv tr

You could change that line to suit or read on. This order may explain why you get the Dutch page.

However there is a simple alternative to messing with the seemingly un-messable.

Create a blank html file (if you want a blank error message or see further down this post) in a text editor and save the file as 404.html to your web root of the site you want the blank error message displayed, for example:
D:\xampp\htdocs\joomla15

Add this line to the vhost container like so:
Code: Select all
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/joomla15"
ServerName joomla15.loc
ErrorDocument 404 /404.html
</VirtualHost>

Save the httpd-vhosts.conf file and restart Apache.

Now test the 404.html by requesting a nonexistent page in your browser, for example:
http://joomla15.loc/testingerror.html

I prefer to instantly redirect those entering a nonexistent page to my main entry index page using a meta tag, for example:
<meta http-equiv="refresh" content="0;URL=http://joomla15.loc/index.php">
If index.php is your main site entry page.

This is not XHTML but simple plain old HTML4 - feel free to use what ever flavor of html you like.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>*** HTML ERROR CODE 404 - PAGE NOT FOUND ***</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="0;URL=http://joomla15.loc/index.php">
</head>
<body>
<center>
<p><b>HTML ERROR CODE 404 - PAGE NOT FOUND</b></p>
<p>Double check the URL in the address bar of your browser!</p>
</center>
</body>
</html>

The entries in the <body> tag are there in case someone turns off meta refresh in their browser.

You can vary this if you want to have a delay before redirecting:
content="0 = instant
content="5 = 5 seconds etc.

'There are many ways to skin a cat' - but the above is simple and quick. :)
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

Postby JoepC » 15. November 2008 00:28

Hi Sharley,

Thanks for the speedy reply!

Thanks to your directions I found the file where the 404 error message that shows up is stored : it's in the apache\error\ directory in the file HTTP_NOT_FOUND.html.var (makes sense :lol: ). So much for the Windows search function :roll:

I chose the easy route you came up with: created a blank 404.html file and saved it to the web root of my construction site, and added the necessary line to the vhost container. After a restart I tested it and it works like a charm!

I'll save the fancy solution you mention for another time...

Thanks again!

Joep
User avatar
JoepC
 
Posts: 2
Joined: 14. November 2008 05:14
Location: Golden, CO USA


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 60 guests