Assign a page to 404

How do I assign a webpage so that it shows up when there’s a 404 or similar error?


Add the following to your .htaccess file:

ErrorDocument 404 /path_to/404.html

(assuming the custom error page is called 404.html)

Unless you’re on Window’s hosting, in which case I haven’t a clue. :slight_smile:

What exactly is .htaccess and where is it kept?

I’ve heard it mentioned and I know that it can be used to password protect…is it Linux only?


I believe it’s specific to Apache, which runs on Linux, but I wouldn’t like to swear to that. :slight_smile:

There’s a handy basic guide here.

Yes, .htaccess files are specific to Apache.

If you are running a different web server (like Linux or IIS) there are similar, but slightly different ways to do so, so we’d need to know which web server you are using.

I was just wondering…for future use.

Thanks, all.


Apache runs on Linux as well as Windows (and some other OSes). It’s just rare to find a Windows based host use it.

.htaccess is Apache specific, though IIS has similar capabilities these days from what I’ve read (different code though). There’s also the Litespeed web server, which aims to be a drop in replacement of Apache (with a lot better performance, or so they claim), and it advertises itself to be .htaccess compatible.

.htaccess is a file you can create and place in the folder you want it to regulate.