View Full Version : .htaccess error pages
November 4th, 2000, 11:30
I forget how to create custom error pages with .htaccess. Anybody know how?
November 4th, 2000, 17:24
Yeah, its not too hard...just put this in the .htaccess of the root directory where you want the errors to be mapped:
ErrorDocument 404 http://url.to.your/error/404page.html
You can also use relative links if you want...
November 6th, 2000, 06:01
BTW, where is the .htaccess file located? Also, what is the .htpassword file for? Suppose I have a folder under the root named "/test", now how do I password protect it using .htaccess and .htpassword?
November 6th, 2000, 07:33
Just use .htaccess. If you put in under /test, then everything in test (including directories) will fall under that password protection.
Make sure your host has enabled overrides though, otherwise you wont be able to do anything :)
November 6th, 2000, 10:58
Sure, so I don't need .htpasswd but what would be the syntax of the .htaccess file to protect "/test" and where should I upload (which folder) it thereafter?
November 6th, 2000, 11:24
Ok, I think you may be a little confused, but let me try to help you out. First off, your .htaccess should be something like this:
<limit get post put>
Now, you may be asking...what the heck is .htpasswd. Well, this is something _you_ dont modify, a program does that for you.
Run this command:
htpasswd /path_to_your/.htpasswd new_user
If you are doing it for this first time do:
htpasswd -c /path_to_your/.htpasswd new_user
The -c will create the file .htpasswd for the first time.
After you do this, it will ask you for a password for that user. Then, that user and that password can be used to access the area.
Every Dir and File under that Dir will be password protected by this list (but can be overridden by other .htaccess files in other dirs).
Hope this info helps :)
November 6th, 2000, 11:26
Incidentally, htpasswd may not be pathed correctly so you may have to use its full path. To find that info out, do:
A lot of hosts (especially paid hosts) nowadays have automated systems that will do this for you. I think there also some CGI scripts that do it for you.
Since PHP is usually not installed in CGI mode, and hence you cant run it command line, you prob wont find any PHP code...although someone may have written an interesting hack :)
Anyway, good luck :)
November 6th, 2000, 23:15
thanks a ton.
Powered by vBulletin® Version 4.1.7 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.