Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I have a PHP question: How do I make a 404 redirect?
#1
I have the page,, how do I make it redirect to it?
Reply
#2
Create a file called .htaccess in the folder where your website is, and put this line in it:

ErrorDocument 404 /error.php
Reply
#3
(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.
Reply
#4
(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.
Reply
#5
kk

*Downloads Apache*
Reply
#6
It worked for me. Thanks.
Reply
#7
Or in my case, you would use the public_html folder to upload.
[Image: chaosthegreat.png]
Reply
#8
So...

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

"ErrorDocument 404 //Errors/404.php"

Correct?
Reply
#9
(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 .
Reply
#10
Windows says
"You must give a file name."
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)