2DWorlds Forums
I have a PHP question: How do I make a 404 redirect? - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: Off Topic (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=5)
+--- Forum: Programming (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=30)
+--- Thread: I have a PHP question: How do I make a 404 redirect? (/showthread.php?tid=7030)

Pages: 1 2


I have a PHP question: How do I make a 404 redirect? - Qwertygiy - 07-18-2011

I have the page,, how do I make it redirect to it?


RE: I have a PHP question: How do I make a 404 redirect? - Jacob__mybb_import1 - 07-18-2011

Create a file called .htaccess in the folder where your website is, and put this line in it:

ErrorDocument 404 /error.php


RE: I have a PHP question: How do I make a 404 redirect? - Dignity - 07-18-2011

(07-18-2011, 10:17 PM)Jacob_ Wrote: Create a file called .htaccess in the folder where your website is, and put this line in it:

ErrorDocument 404 /error.php

Didn't work.



RE: I have a PHP question: How do I make a 404 redirect? - Jacob__mybb_import1 - 07-18-2011

(07-18-2011, 10:45 PM)roperson Wrote:
(07-18-2011, 10:17 PM)Jacob_ Wrote: Create a file called .htaccess in the folder where your website is, and put this line in it:

ErrorDocument 404 /error.php

Didn't work.

This only works on Apache (by far the most popular web server to use with PHP). If you're using IIS, you'll have to do it some other way.


RE: I have a PHP question: How do I make a 404 redirect? - Dignity - 07-18-2011

kk

*Downloads Apache*


RE: I have a PHP question: How do I make a 404 redirect? - Qwertygiy - 07-18-2011

It worked for me. Thanks.


RE: I have a PHP question: How do I make a 404 redirect? - Chaos - 07-19-2011

Or in my case, you would use the public_html folder to upload.


RE: I have a PHP question: How do I make a 404 redirect? - Dignity - 07-19-2011

So...

Quote:I have this file called "mod.htacces" and it contains

"ErrorDocument 404 //Errors/404.php"

Correct?


RE: I have a PHP question: How do I make a 404 redirect? - Jacob__mybb_import1 - 07-19-2011

(07-19-2011, 05:27 PM)roperson Wrote: So...

Quote:I have this file called "mod.htacces" and it contains

"ErrorDocument 404 //Errors/404.php"

Correct?

The file name should just be .htaccess, with nothing before the .


RE: I have a PHP question: How do I make a 404 redirect? - Dignity - 07-19-2011

Windows says
"You must give a file name."