Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect to external site on 500 error with .htaccess

I am working on a website (scratchyone.com). I need to have my .htaccess redirect to an external page

http://scratchywon.github.io/scratchyone.com/errors/500.html

on a 500 error. I am forcing a 500 with php.

http://scratchyone.com/500/

Here is my current code:

ErrorDocument 500 http://scratchywon.github.io/scratchyone.com/errors/500.html

EDIT: ErrorDocument 404 http://scratchywon.github.io/scratchyone.com/errors/500.html works Now that I am using php to send the 500 error, the page doesn't display. It just displays the browser's default "500: Could not display"

like image 781
Scratchywon Avatar asked Jan 28 '26 17:01

Scratchywon


1 Answers

Internal error in .htaccess not relay custom ErrorDocument (!) and simulate 500 error via PHP is not quite possible - when your script run it's too late - error document redirection is handled by apache mod_core (!) and PHP only send status. So I think you can forget about PHP 500-simulation.

Try to make a directory next to main .htaccess and inside make faulty .htaccess

Or maybe this will be helpful for you: https://www.digitalocean.com/community/tutorials/how-to-configure-apache-to-use-custom-error-pages-on-ubuntu-14-04

Section about 500 provide information how to simulate this error via bad proxy.

like image 132
Neuronus Avatar answered Feb 01 '26 06:02

Neuronus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!