Customized error messages 403 404

jingjang - May 1, 2008 - 12:49

Hi,

Ive 1 html (static) page and i want that page as 404 or 403 page

ive set in config
my_site.com/admin/settings/error-reporting
Default 403 (access denied) page: 403.html
Default 404 (not found) page: 404.html

both 403.html and 404.html i place them in web root
+ public_html/403.html
+ public_html/404.html

but not work
i know that i can create a page in drupal and set as it, but in my case i need use html static page :(

And second, i use .htaccess to Customized error messages 403 404
# Customized error messages.
# ErrorDocument 404 /index.php
ErrorDocument 403 http://localhost/403error.html
ErrorDocument 404 http://localhost/404error.html

but its not work too.

Can you give me some idea ?
Thank you :)

Drupal 6.x + apache2.0 + php5.2 + windows xp + mysql 5.1

hmm, i'm not sure why you

arh1 - May 1, 2008 - 16:37

hmm, i'm not sure why you wouldn't want to use Drupal's error reporting here, but assuming you have a good reason for that...

1) in your .htaccess file, the 404 error line should be:
ErrorDocument 404 /404error.html

2) your 404 settings at /admin/settings/error-reporting will be irrelevant

i don't think you're going to be able to get the 403 error to behave the way you want. note that the Drupal settings for that are relevant to Drupal access/permission hooks, as opposed to the Apache 403 error relevant to web server user/group permissions. that is, i don't think it makes any sense to use .htaccess to return a static page for a Drupal access denied error. someone correct me if i'm wrong there.

yes, ive try to

jingjang - May 1, 2008 - 16:43

yes, ive try to use,
ErrorDocument 404 /404error.html

after that, i restart apache
but its still not work, might i have to change something in httpd.conf ?

(because im test on my localhost so i put http://localhost/404.html)

at less i want to change 404 error message to static page.

thank for help

thinking about this a bit

arh1 - May 2, 2008 - 00:00

thinking about this a bit more, this technique won't work. the last few lines of Drupal's default .htaccess file tell Apache that if the requested URL doesn't map to an existing file or directory, the URL should be rewritten like index.php?q=/path/here . in other words, Drupal's handling all requests, whether the file is found or not. and i'm not really sure how the ErrorDocument directive is used at all.

anyone else with more Apache-fu?

I have the same problem.

newbii - September 17, 2008 - 21:51

I have the same problem. That's why I am here.

Also my question

bigheadfish - July 13, 2008 - 10:12

This is also my question

Any update?

Can I modify index.php?

bigheadfish - July 13, 2008 - 17:07

Just wonder if I can modify index.php to do what I need?

Really need to fix this problem.

Thanks.

Thanks

bigheadfish - July 14, 2008 - 03:19

But that is not what I need. I need a static HTML page for 404 error.

 
 

Drupal is a registered trademark of Dries Buytaert.