Apache Custom Error Pages Ubuntu
Contents |
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 By: Etel Sverdlov Subscribe Subscribed Share Contents Contents We hope apache custom 404 error page you find this tutorial helpful. In addition to guides like this one, we provide simple
Apache Custom 500 Error Page
cloud infrastructure for developers. Learn more → 7 How To Create a Custom 404 Page in Apache Posted Jul 10, 2012 87.2k apache custom error log virtualhost views Apache Why Create a Custom 404 Page A custom 404 page lets you provide a user-friendly website to your visitors even in the midst of an error. Very few users, when presented with a 404, will
Apache Set 404 Page
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 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. php custom error page 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 Author: Etel Sverdlov 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 more about Hacktoberfest Related Tutorials How To Migrate your Apache Configuration from 2.2 to 2.4 Syntax. How To Get Started With mod_pagespeed with Apache on a CentOS and Fedora Cloud Server How To Use the .htaccess File How To Set Up Mod_Rewrite (page 2) How to Create an Intranet with OpenVPN on Ubuntu 16.04 9 Comments Log In t
404 page not found error page Written by Guillermo Garron Date: 2013-01-11 15:47:35 00:00 Two years ago I have posted about how to set custom 404 "Page not found" error in Nginx.
Tomcat Custom Error Page
I am working more with Apache than with Nginx these days. After learning about
Apache Default Error Page
Apache MPM Worker I started with Apache again. Well today I will show you different ways to configure 404 custom pages with apache 404 redirect Apache2. For my tests I have used Ubuntu 12.10, but it should work the same on any other distribution. Custom 404 "Page Not Found" with Apache2 There are different options. .htaccess file When you do not have https://www.digitalocean.com/community/tutorials/how-to-create-a-custom-404-page-in-apache access to the Apache configuration file, which is the case with mosts shared web hosting providers. But they most of the time gives you access to the htaccess file where you can configure your custom error page or message. With a text editor create an error page, you can name it anything you want, what about 404.html Inside you can enter something like this:
Page not found
Sorry but the page you are looking for is not here, please got to our Home page
Now add to your htaccess file, this line: ErrorDocument 404 /404.html Be sure to have 404.html on the root folder of your server. Virtual host individual file If you are working with Ubuntu, you will find two important folders under Apache configuration which are: /etc/apache2/sites-available /etc/apache2/sites-enabled The latter are symlinks to the former, so you can go to that folder and pick each of files there (each one is one virtual server) and add this line before the tag. ErrorDocument 404 /404.html Global configuration You can also configure one path for all Virtual servers. In that case add the line. ErrorDocument 404 /404.html To the file /etc/apache2/conf.d/localized-error-pages, you can run this command: sudo sh -c 'echo "ErrorDocument 404 /404.html" >> etc/apache2/conf.d/localized-error-pages' Final notes If you are using a CMS like Drupal or Wordpress they are going to manage 404 errors, and that is a better way, but if your site is a static site, then you can add custom 404 pages this way, and make that page match your design. permalink If you enjoyed the article, please share it Contact All rights reserved. Hosted at Digital Ocean Design by: Guilgeneric error responses in the event of 4xx or 5xx HTTP status codes, these responses are rather stark, uninformative, and can https://httpd.apache.org/docs/2.4/custom-error.html be intimidating to site users. You may wish to provide custom error responses which are either friendlier, or in some language other than English, or perhaps which are styled more in line with your site layout. Customized 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 error page values are provided, so that the 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 custom error page configured using the ErrorDocument directive, which may be 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>