WordPress 404 Error Page

Configuring custom error pages in Tomcat

Since tomcat doesn’t come with user friendly messages when an error occurs. This situation can be handled by Configuring custom error pages in Tomcat.

The most common type of error messages are 404, 400 & 500 . As the tomcat’s default error pages expose the Version of tomcat, it’s important to hide the version information as part of security best practices.

Let’s get started with the configuration stuff now.
I have installed Tomcat under /opt so my CATALINA_HOME value is /opt/apache-tomcat-7.0.63/

STEP1: Tomcat Configuration

Edit /opt/apache-tomcat-7.0.63/conf/web.xml and add the following configuration just before

STEP2: Creating custom error pages.

I have deployed my application as ROOT, so i will place my 3 custom error html files under /opt/apache-tomcat-7.0.63/webapps/ROOT/
Now create 3 seperate html files called 404.html, 500.html & 400.html

touch 404.html 500.html 400.html

Now i will update these files with suitable error messages.

STEP3: Restarting Tomcat server

Once you restart tomcat server, try to access any non existing URL on the server & you should be able to see custom error messages as you created

WordPress 404 error page

I am using FastCGI to setup PHP. I’ve followed the instructions on the iis.net website. I added the handler mapping, edited the php.ini file as specified. None of it works, I just get a 404.0 error saying "The page you are looking for has been removed", even though the physical path displayed on the error page exists. After trying this manual method (unzipping php, manually adding handle mapping, etc), I removed everything and I tried the Web Platform Installer (ugh) but I still have the same issue.

A little more information:
The Detailed Error page says the handler is my StaticFile handler (not PHP FastCGI). It also gives error code 0x80070002

When I look at the logs, it shows "GET /php.ini" as giving the 404 error. Why is IIS looking for that?

When I was getting this error message I noticed that I didn’t even have php-cgi.exe file in the C:\Program Files\PHP directory.

The other helpful method I found was that if you are getting FastCGI errors, to try double clicking directly on the php-cgi.exe file and then look in the Windows Application logs for errors if it crashes. I got this from this comment from a PHP Bug report:

[2010-04-22 06:43 UTC] sejo at iteontech dot com

After debugging IIS and a bunch of other crazy things, this is what worked for me. I have PHP 5.3.2 on Windows 7 and IIS 7. Try to execute PHP-CGI.EXE (BY DOUBLECLICKING ON IT). See if you get any error messages/ pop-ups. I got a ton of them and it all boiled down on having a bunch of extensions turned on, but not being available in my ext folder. Clear the PHP.INI of those invalid extensions and the problem should go away.

Well, I’m not sure what I did, but somehow I fixed it. I removed the website and re-added it, then checked my FastCGI Mapping settings, everything looked just like before, but this time it works. I’d still like to know why I was getting the error if possible.

By default IIS will not serve any file for which it does not have a valid MIME Type mapping and will 404 the response

If the .php extension does not have a MIME type defined for it for the website that you’re trying to run PHP then IIS will not serve the file even if there is a relevant handler for that file type.

Just checked the IIS 7 Manager on my server and there is no mapping for PHP by default in the MIME Types list, I suspect that if your website existed before you installed FastCGI it does not automatically add the mapping to existing websites whereas when you created the new website FastCGI was already installed.

I could of course be completely wrong about that last bit but the File extension to MIME Type mapping issue is a security feature of IIS – no mapping = no files served with that extension

Just wanted to add the stupid answer encase anyone else find this issue with the same problem. "A mate" created the test file on the server. He was getting the 404 error. What had happened, was that windows was hiding file extensions, so the file was actually called index.php.txt. Not a funny 30 minutes.

My solution to this error had two parts:

  1. (from @icc97’s answer) — double-click on php-cgi.exe in your PHP folder to make sure it can start up ok.
  2. Turns out that my index.php file was really named index.php.htm (turn off "hide file extension names")

I dealt with a similar issue, all replies I could find on the web were of no help whatsoever. First off I assume you have tried running http://yourservernamehere/check.php and everything seems to come back correct. IF this is the case I would suggest checking in your php.ini file the setting under:

[Date] ; Defines the default timezone used by the date functions date.timezone =

Most likely it is blank like mine was, this generates a silly error with newer version of php and for whatever reason you will be dead in the water until you have a timezone specified (mine is America/Chicago).

I may be assuming a lot about your situation but it sounds very similar to mine and I spent several days frustratedly searching for an answer.

After migrating my site, my front page works, but all other pages give a 404 error

First of all: this is not bad. Even though your front page is only one page, if it migrated correctly, then you’re 99% there.

If your front page works, but others give 404, then there’s only one thing missing: a piece of configuration in your webserver. In particular, it’s the configuration for permalinks – the configuration to send access to pretty URLs like www.example.com/about-us/ into WordPress’s actual files on-disk.

Because this is part of the webserver configuration, it’s one level above WordPress, and not under WordPress’s direct control. Therefore, it sometimes needs a small piece of manual intervention from you to get working.

How can I know what webserver my hosting company is using?

It may tell you on your 404 error page. If not, then go to your UpdraftPlus settings page (remember that you’ll need to use the login details from the site you migrated – login details are part of what’s migrated), and click on the ‘Expert / Debugging Tools’ tab. In that tab, towards the top, there should be a line ‘Web server’.

Failing that, you can ask your web hosting company – they’ll know!

Leave a Reply

Your email address will not be published. Required fields are marked *