Custom Error Pages On Apache Web Server
Contents |
generic error responses in the event of 4xx or 5xx HTTP status codes, these responses are rather stark, uninformative, and can be intimidating to
Apache Custom 404 Error Page
site users. You may wish to provide custom error responses which are either friendlier, apache web server default page or in some language other than English, or perhaps which are styled more in line with your site layout. Customized apache set 404 page error responses can be defined for any HTTP status code designated as an error condition - that is, any 4xx or 5xx status. Additionally, a set of values are provided, so that the
Apache Tomcat Default Page
error document can be customized further based on the values of these variables, using Server Side Includes. Or, you can have error conditions handled by a cgi program, or other dynamic handler (PHP, mod_perl, etc) which makes use of these variables. Configuration Available Variables Customizing Error Responses Multi Language Custom Error Documents See alsoComments Configuration Custom error documents are configured using the ErrorDocument directive, which may be
Php Custom Error Page
used in global, virtualhost, or directory context. It may be used in .htaccess files if AllowOverride is set to FileInfo. ErrorDocument 500 "Sorry, our script crashed. Oh dear" ErrorDocument 500 /cgi-bin/crash-recover ErrorDocument 500 http://error.example.com/server_error.html ErrorDocument 404 /errors/not_found.html ErrorDocument 401 /subscription/how_to_subscribe.html The syntax of the ErrorDocument directive is: ErrorDocument <3-digit-code>
In submit Tutorials Questions Projects Meetups Main Site logo-horizontal DigitalOcean Community Menu Tutorials Questions Projects Meetups Main Site Sign Up Log In submit View All Results apache default error page By: Etel Sverdlov Subscribe Subscribed Share Contents Contents We hope you find this
Apache 404 Error
tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more → apache 404 redirect 7 How To Create a Custom 404 Page in Apache Posted Jul 10, 2012 88k views Apache Why Create a Custom 404 Page A custom 404 page lets you provide a https://httpd.apache.org/docs/2.4/custom-error.html user-friendly website to your visitors even in the midst of an error. Very few users, when presented with a 404, will do more beyond click back to get out of the mistake. A custom 404 page is a good opportunity to keep them on your site and do more to redirect them to their destination. Setup Before going through this tutorial, you should https://www.digitalocean.com/community/tutorials/how-to-create-a-custom-404-page-in-apache already have created a custom 404 page and saved it into your website's directory. Implement the 404 Page To edit the 404 page, open up or create the site's .htaccess file. You can create it in a text editor and upload it to your site via the FTP server. Keep in mind that the name of the file has to be simply .htaccess. Add the following line to the file, replacing new404.html with the correct new error page name: ErrorDocument 404 /new404.html Save and Exit. Keep in mind that the Apache looks for the 404 page located within the site's server root. Meaning that if you place the new error page in a deeper subdirectory, you need to include that in the line, making into something like this: ErrorDocument 404 /error_pages/new404.html See the 404 Page Now visiting unavailable pages on your site should display your custom 404 page! By Etel Sverdlov By: Etel Sverdlov Upvote7 Subscribe Subscribed Share Hacktoberfest Give back to open source this October Celebrate open source software by contributing to GitHub-hosted open source projects for the chance of getting your own limited-edition Hacktoberfest T-shirt. Learn
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta http://askubuntu.com/questions/53199/custom-apache-404-page Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Ask Ubuntu http://serverfault.com/questions/362234/apache-default-error-page Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign error page up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Custom Apache 404 page up vote 15 down vote favorite 4 I want to customise the 404 page of my Apache Webserver on Ubuntu to something other than the general: Not Found The requested URL apache web server /***** was not found on this server. ______________________________________________________ Apache/*.*.** (Ubuntu) Server at **** Port 80 How can this be accomplished? apache2 share|improve this question edited Nov 3 '14 at 16:19 Braiam 38.8k1693153 asked Jul 15 '11 at 12:43 Amith KK 6,8341046103 webdesign.about.com/od/apache/ht/ht404apache.htm is a short guide. –N.N. Jul 15 '11 at 12:50 add a comment| 5 Answers 5 active oldest votes up vote 19 down vote accepted I found the answer myself. You have to edit the file /etc/apache2/conf.d/localized-error-pages sudoedit /etc/apache2/conf.d/localized-error-pages You can enter plaintext or link to a script or html share|improve this answer edited Jul 15 '11 at 12:54 Marco Ceppi♦ 31k20132180 answered Jul 15 '11 at 12:53 Amith KK 6,8341046103 add a comment| up vote 4 down vote
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Server Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Apache default error page up vote 0 down vote favorite I have a development server and I would like to configure Apache so that when a 500 http code is generated it will display the error directly in the response (i.e. what would be printed to /var/log/httpd/error_log is displayed to the user). However, I cannot figure out where this directive is. Any help? apache-2.2 configuration share|improve this question edited Feb 21 '12 at 14:59 Kyle Smith 7,6651730 asked Feb 21 '12 at 14:35 Thomas 112212 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote Set up Apache to use server-side includes (.shtml files) and configure a custom error page as above (though naturally pointing to an .shtml file), and in that custom error page use something like this:
The requested page,
, does not work properly.
Click here to return from whence you came.
--> share|improve this answer answered Jul 14 '12 at 16:47 Lee Gee 18314 add a comment| up vote 2 down vote I believe the directive you are looking for is ErrorDocument (documented here). For example: