Error docs I.E. 404, 403.etc

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
chris98
Forum Contributor
Posts: 103
Joined: Tue Jun 11, 2013 10:47 am
Location: England, United Kingdom

Error docs I.E. 404, 403.etc

Post by chris98 »

I'm not really sure which forum this belongs in, but I will post it here.

Some websites can hide the URL of their error pages.How do they do this?

I.E.

http://stronghold2.heavengames.com/hgfh ... fhgfhgfhgf


How can you stop it from redirecting to the error page, and instead just show the content of the error page?

Thanks in advance.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Error docs I.E. 404, 403.etc

Post by requinix »

Don't actually redirect and just show the error page. How, depends on why the error page is happening, like your PHP code could do it, or your .htaccess could do it, or Apache could do it.
User avatar
chris98
Forum Contributor
Posts: 103
Joined: Tue Jun 11, 2013 10:47 am
Location: England, United Kingdom

Re: Error docs I.E. 404, 403.etc

Post by chris98 »

This is what I currently have.How could I change it so that it wouldn't redirect?

ErrorDocument 404 http://www.mysite.com/404.php
Last edited by chris98 on Sat Mar 08, 2014 10:09 am, edited 1 time in total.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Error docs I.E. 404, 403.etc

Post by requinix »

Don't put the domain name in there.

ErrorDocument
Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as http in front of it), Apache will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server.
User avatar
chris98
Forum Contributor
Posts: 103
Joined: Tue Jun 11, 2013 10:47 am
Location: England, United Kingdom

Re: Error docs I.E. 404, 403.etc

Post by chris98 »

Thanks, that has done it now.
Post Reply