Error 404 Page Not Found Apache
Contents |
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 apache custom 404 error page about how to set custom 404 "Page not found" error in Nginx. apache tomcat error 404 the requested resource is not available I am working more with Apache than with Nginx these days. After learning about Apache MPM Worker I started
Error 404 Apache Tomcat Eclipse
with Apache again. Well today I will show you different ways to configure 404 custom pages with Apache2. For my tests I have used Ubuntu 12.10, but it should work the
Apache Set 404 Page
same on any other distribution. Custom 404 "Page Not Found" with Apache2 There are different options. .htaccess file When you do not have 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. http 404 apache 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/cohere 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
Php 404 Error Page
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs error 403 apache Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just error 500 apache like you, helping each other. Join them; it only takes a minute: Sign up 404 Not Found with Apache server up vote 2 down vote favorite 1 I am trying to get my website setup and whenever https://www.garron.me/en/linux/custom-404-page-not-found-error-apache2-ubuntu-linux.html I try to use my domain name to connect I get "404 Not Found" When I try and reach the site with my IP it works fine. I am on Debian x64. Can someone please help me get this resolved. If you need more information just ask. Httpd.conf Apache2.conf apache http-status-code-404 share|improve this question edited Nov 28 '12 at 9:33 Arnestig 1,231822 asked Nov 22 '12 at 6:04 Nicholas Brown 11113 @Arnestig: You http://stackoverflow.com/questions/13506716/404-not-found-with-apache-server don't know if the problem actually is debian specific or not. –Stefan Steinegger Nov 28 '12 at 9:35 @StefanSteinegger: Well we don't know if this problem is caused by a hardware issue, software issue or some other problem. It's good that Nicholas Brown informs us that he's running on Debian x64, but the question itself is not related to Debian. He's not asking a question regarding how Debian works / behaves etc. This question is entirely directed at getting apache up and running. Therefore the tag "apache". –Arnestig Nov 28 '12 at 9:37 @Arnestig: good points. –Stefan Steinegger Nov 28 '12 at 9:40 add a comment| 3 Answers 3 active oldest votes up vote 2 down vote Where do you have your website ? On local network or on a hosting service provider? In any case you need to add your web-server ip to the DNS server (either local or www) depending upon your requirements, without knowing where your webserver is local or global it is difficult to give you an answer share|improve this answer answered Nov 22 '12 at 6:20 ajet 365313 Good point. I didn't even consider the DNS settings, but that should be looked at as well. –Kenzo Nov 22 '12 at 6:24 My site is on a providers VPS. –Nichol
generic error responses in the event of 4xx or 5xx HTTP status codes, these responses are rather stark, uninformative, and can be intimidating to site users. You may wish https://httpd.apache.org/docs/2.4/custom-error.html 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 values are provided, so that the error document can be customized further based on the values of error 404 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 used in global, virtualhost, or directory context. It may be used in .htaccess files if 404 error page 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>