Custom Error Pages On Apache
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 apache errordocument Subscribed Share Contents Contents We hope you find this tutorial helpful. In addition to
Apache2 Custom Error Pages
guides like this one, we provide simple cloud infrastructure for developers. Learn more → 7 How To Create a Custom
Apache Custom Error Pages Httpd Conf
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 user-friendly website to your visitors even in the
Apache Custom 404 Error Page
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 already have created a custom 404 page and saved it into your website's apache custom error log virtualhost 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 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
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 set 404 page By: Justin Ellingwood Subscribe Subscribed Share Contents Contents We hope you find this php custom error page tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more → tomcat custom error page 6 How To Configure Apache to Use Custom Error Pages on Ubuntu 14.04 Posted Jun 9, 2015 45.6k views Apache Ubuntu Introduction Apache is the most popular web server in the https://www.digitalocean.com/community/tutorials/how-to-create-a-custom-404-page-in-apache world. It is well-supported, feature-rich, and flexible. When designing your web pages, it is often helpful to customize every piece of content that your users will see. This includes error pages for when they request content that is not available. In this guide, we'll demonstrate how to configure Apache to use custom error pages on Ubuntu 14.04. Prerequisites To get started on with https://www.digitalocean.com/community/tutorials/how-to-configure-apache-to-use-custom-error-pages-on-ubuntu-14-04 this guide, you will need a non-root user with sudo privileges. You can set up a user of this type by following along with our initial set up guide for Ubuntu 14.04. You will also need to have Apache installed on your system. Learn how to set this up by following the first step of this guide. Creating Your Custom Error Pages We will create a few custom error pages for demonstration purposes, but your custom pages will obviously be different. We will put our custom error pages in the /var/www/html directory where Ubuntu's Apache installation sets its default document root. We'll make a page for 404 errors called custom_404.html and one for general 500-level errors called custom_50x.html. You can use the following lines if you are just testing. Otherwise, put your own content in these locations:
- echo "
Error 404: Not found :-(
" | sudo tee /var/www/html/custom_404.html - echo "
I have no idea where that file is, sorry. Are you sure you typed in the correct URL?
" | sudo tee -a /var/www/html/custom_404.html - echo "
Oops! Something went wrong...
" | sudo tee /var/www/html/custom_you click a link and encounter a "404 File Not Found" error? Do you: Click on the BACK button of your browser and go somewhere else? Try to back up one directory in the URL (ie, web address) and try again? http://www.thesitewizard.com/archive/custom404.shtml Write to the webmaster of the site and the referring site to inform them of the situation? http://askubuntu.com/questions/53199/custom-apache-404-page If you are like most people, you'll simply click on the BACK button and try another place. The majority of people don't even know that there are any other alternatives. You thus need to do something so that you do not lose this group of people who come to your site by following an old link or by typing your URL incorrectly. Requirements for Customizing the 404 File Not custom error Found Page It is not possible to customize your 404 error page if your web host has not enabled this facility for your website. For example, at the time of this writing, if you host at free web hosts like Geocities or Tripod, you will not be able to customize your 404 Error Page. Commercial web hosts, on the other hand, usually provide this facility. If your web host supports a way to customise your 404 file, you will usually find mention of it somewhere in their custom error page documentation (or advertisements). In fact, if they mention somewhere that you can customize a file named ".htaccess", it probably means that you can also customize your 404 File Not Found error page. The .htaccess file is what Apache web servers use to allow you to fine-tune your web server configurations at a directory level. Other types of web servers handle the customization of 404 error pages differently. (A web server, in this context, is the software that runs on your web host's computer. It is the program that "serves" your web pages to your visitors.) Step One: Creating/Modifying the .htaccess File This step may not be necessary in all situations. Some web hosts already configure their web server so that it will look for a specific file in your web directory when a certain document cannot be found. If so, simply skip this step. If your web server is not an Apache web server, you will have to find out from your web host what you need to do to enable the server to serve your customized file when a file cannot be found. This article only applies to websites that are hosted on Apache web servers. Otherwise, the first thing you need to do is to add the following line to a file named .htaccess (note the preceding period). In most instances, no such file will exist, and you can simply create one with a text editor (such as Notepad on Windows). Incidentally, if you are using Notepad on Windows, you will need to enter ".htacces
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 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 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 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 /***** 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
ServerAdmin admin@host.ru ServerName host.ru ServerAlias www.host.ru DocumentRoot /home/WebServer/www/host.ru/public_html/ ErrorLog /home/WebServer/www/host.ru/logs/error.log CustomLog /home/WebServer/www/hostu/logs/access.log combined Alias /error_html/ "/home/WebServer/www/host/error_html/"