Forum Moderators: phranque
Please tell me what do I have to add in my .htaccess file so when somebody looks for a page on my website that doesn't exist, to be redirected to an html error page (that I customize) instead of the standard 404 page not found.
Right now my htaccess file looks like this:
# -FrontPage-
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName mydomain.com
AuthUserFile /home/httpd/vhosts/mydomain.com/httpdocs/_vti_pvt/service.pwd
AuthGroupFile /home/httpd/vhosts/mydomain.com/httpdocs/_vti_pvt/service.grp
[edited by: rcjordan at 7:36 pm (utc) on Oct. 26, 2003]
[edit reason] changed to generic domain [/edit]
ErrorDocument 404 [YourDomain.com...]
If you specify a canonical URL in ErrorDocument, the server will respond to requests for missing pages with a server status of 302-Found, not 404-Not Found. This can really screw up search engine listings.
Do not use a full URL -- use a local path only!
ErrorDocument 404 /YourCustomErrorPage.htm
Jim
ErrorDocument 404 [YourDomain.com...]
or
ErrorDocument 404 /YourPage.htm
If after checking these you still get a 500, then try adding this directive above the ErrorDocument one. Some servers need it for certain directives and others don't. Not sure why.
Options +FollowSymlinks
[edited by: jdMorgan at 7:48 pm (utc) on Oct. 27, 2003]
[edit reason] Edited typo at poster's request [/edit]
Jim
I have a site protected with a user name and password. This site it's hosted on an old server and I want to transfer it on my new dedicated server. (with no downtime or unprotected)
the htaccess file looks like this:
# -FrontPage-
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
require valid-user
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthType Basic
AuthName mysite.com
AuthUserFile /home/virtual/site13/fst/var/www/html/_vti_pvt/service.pwd
AuthGroupFile /home/virtual/site13/fst/var/www/html/_vti_pvt/service.grp
I made a copy of this site and uploaded on the new server. The htaccess of the new site is identical with the other one:
Also I uploaded the htpasswd from the old site (same password file) and put it in the root (as on the other site)
Now, when I try to access the site on the new server it ask me for a user name and password but it doesn't accept the password.
Could you please guide me on this?
This is a new subject and deserves a new thread, I think...
> Also I uploaded the htpasswd from the old site (same password file)
I don't think this will work -- You will probably need to create new encrypted passwords for use on the new server. The "seed" used to encrypt passwords differs from server to server, and the old encrypted passwords will not be valid on a different server.
You can use the same clear-text passwords, but they will need to be re-encrypted and saved in a new .htpasswd file.
Jim
try adding this directive above the ErrorDocument...
I will try that (unfortunately I can't update my site at the moment). Anyway, I was wondering whether some kind of wrapper / header was needed, and you have just answered that one for me. Thanks.
jdMorgan:
ErrorDocument requires that AllowOverride All or AllowOverride FileInfo be set
I could ask my ISP, but I thought the server would simply ignore the un-allowed statements, rather than give me a 500.