PDA

View Full Version : Trying to use custom error page



skyweb
04-08-2009, 09:21 AM
Hello, novice bluehost user with limited technical skill (using DW CS3) trying to setup custom error pages and avoid indexing of directories before I repoint my site to bluehost.

The default 403 page I'm getting is a generic green/blue colored background error page with the following:


The server can not find the requested page:

403 Forbidden
Access is forbidden to the requested page:

domainname.com/~userid/images/ (port 80)
Please forward this error screen to <IP Address>'s WebMaster.
--------------------------------------------------------------------------------
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/x.x.x.xxxx Server at <IP address> Port 80

Fine, the 'no indexing' that I selected in the cpanel works and I get an error page. This format also shows for a 404 error.

However, when I upload a modified .htaccess file (after turning off "no indexing" in the cpanel) with the following coding, it still prevents indexing but doesn't use the error pages I point to. The .shtml files are in the root directory as is the .htaccess file.


# Use PHP5 as default
AddHandler application/x-httpd-php5 .php

Options -Indexes

ErrorDocument 400 /400.shtml
ErrorDocument 401 /401.shtml
ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
ErrorDocument 500 /500.shtml

I'm missing something here but I don't know what. Any ideas?

Thanks!

wysiwyg
04-08-2009, 01:41 PM
box##.bluehost.com/~userid/images/ is not the path you should be accessing your files from.

If your domain is redirecting to it, there is something else going on here.

skyweb
04-08-2009, 02:09 PM
In the orginal message I mentioned, "before I repoint my site to bluehost."

At this point I'm simply trying out my account, my domain name hasn't been transfered to bluehost yet, hence the unusual path. This is why it is showing up as domainname.com/~userid/. Maybe I could have actually used the domain name at this point, but I didn't.

The /images/ directory is there because I was checking to see if it would provide the index for that directory, which it didn't.

Did this explanation make sense?

wysiwyg
04-08-2009, 02:15 PM
Okay, it's not using your custom error page because you're using that URL to access it. It's using the server's error page.

/403.shtml would be pointing to http://box1.bluehost.com/403.shtml for example.
/~userid/403.shtml would be your file.

felgall
04-08-2009, 02:39 PM
Most if not all of those error pages you are trying to use are the default ones that your site is going to use without a .htaccess file anyway and so those entries in the .htaccess will not be needed. You only need to use those statements if you want to give the pages a different filename from the default.

skyweb
04-08-2009, 07:34 PM
Thanks wysiwyg! Changing the path slightly did result in success. I can now create my custom error pages.

With regard to,
Most if not all of those error pages you are trying to use are the default ones that your site is going to use without a .htaccess file anyway and so those entries in the .htaccess will not be needed. You only need to use those statements if you want to give the pages a different filename from the default.

Actually, somewhere early on I may have accidently removed some of the .htaccess contents that would have done what you describe. When the .htaccess only had the 'Use PHP5 as default' coding in it and I forced an error with my browser, I ended up seeing some error pages that were much different than the simple error .shtml files.

This is THE first question I've posted on ANY technical forum and the response is most helpful. It's scary some of the stuff I find myself doing these days! :eek: