vote up 0 vote down star

I need to create 404 error pages but it should be usable for all of users, If I use ErrorDocument 404 /404.php it will display "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request." on users web site, How to create it without placing 404.php in every users documentroot?

flag
This should probably be posted on serverfault – tronda Jun 2 at 11:46

migrated from stackoverflow.com

3 Answers

vote up 1 vote down

You could configure your apache with rewrite rule as above:

ErrorDocument 404 http://www.domain.com/customerrors/page-404.html
# or maybe .php if you want some smarts in that page?

but also put a system-wide alias in place for the /customerrors/ path

Alias /customerrors /var/www/html/custom-errors/
<Directory /var/www/html/custom-errors/>
  # make sure the location can be used to serve files
  Order allow,deny
  Allow from all
</Directory>

You'll just have to be a little careful to not override a website-local URL.

link|flag
vote up 0 vote down

Configure your apache with rewrite rule

ErrorDocument 404 http://www.domain.com/custom/page-404.html
link|flag
thank you for fast response :) but it will redirect all users 404 to domain.com? is there a way to not redirect to other domain but stay in users domain? – Anonymous Jun 2 at 11:53
vote up 0 vote down

just put filepath without http and domain: ErrorDocument 404 /errordir/myerrormsg.html

link|flag

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.