Boardy
Boardy

Reputation: 36237

.htaccess 404 redirect to php file

I am currently trying to create a .htaccess file that redirects to a php file if a error 404 occurred.

However, When I choose a php file it just displays the default 404 not found error, but if i change it to html it then works fine and displays my page.

What is wrong with this.

Thanks for your help

Upvotes: 0

Views: 480

Answers (1)

Charlie
Charlie

Reputation: 7349

Sadly there isn't enough to go on here, but I can give you some questions to help you debug this (too much for a comment otherwise I would have done that):

  • If you navigate to the php file is it hosted through Apache correctly (when not being used as an ErrorDocument)?
  • Are there errors in your apache logs from trying to retrieve the php file as an error document?
  • Is the "default" 404 error the one from Apache or your browser?
  • If it's Apache's does it say there was an error retrieving the configured error document?
  • If it's the one from your browser is the php file large enough to not be om nom nommed by the browser (for example: 512 bytes in IE )?

Upvotes: 1

Related Questions