Custom 403 Error Pages
Contents |
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 custom 403 page apache or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x
Django Custom 403 Page
Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it best 403 error pages only takes a minute: Sign up Custom Error 403 Page PHP up vote 8 down vote favorite I created a .htaccess inside a directory in which I don't want the files to be directly accessed. It works and fires the
403 Error Page Design
default 403 page (Access forbidden!) of the Apache server. How can I create a custom 403 page? Thanks! php apache .htaccess mod-rewrite http-status-code-403 share|improve this question edited May 27 '15 at 15:11 Dendromaniac 322114 asked Jan 2 '12 at 17:21 fart-y-goer 3372621 1 If you can check my questions, almost all of it show the code that I have as of the time the question was asked. Unfortunately for this, I don't have any idea. Forgive me. –fart-y-goer Jan 2 403 error page examples '12 at 17:29 add a comment| 2 Answers 2 active oldest votes up vote 20 down vote accepted In your .htaccess file you can specify what document you want as your default 403 error document ErrorDocument 403 /dir/file.html Here the directory is relative to the document root. share|improve this answer answered Jan 2 '12 at 17:25 JK. 4,26711621 add a comment| up vote 6 down vote You can do something like the following: #Rewrite URL's RewriteEngine On RewriteRule ^404/?$ errors/404.html [NC] # Enable Error Documents # (404,File Not Found) | (403,Forbidden) | (500,Internal Server Error) ErrorDocument 404 /404 ErrorDocument 403 /404 What this is doing is turning on the RewriteEngine so we can redirect url's nicely, then we are defining using the RewriteRule that /404/ or /404 should redirect to the custom 404 page. I then state that the ErrorDocument 404 and 403 should redirect to the 404 page. I do this for security so, a user does not know whether or not a file exists or if they just don't have access. share|improve this answer answered Jan 2 '12 at 17:27 Aramael Pena-Alcantara 129117 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and term
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
403 Error Page Template
users. You may wish to provide custom error responses which are either friendlier, or
Custom 404 Error Page
in some language other than English, or perhaps which are styled more in line with your site layout. Customized error custom 401 error page 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 http://stackoverflow.com/questions/8703540/custom-error-403-page-php 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 used in global, https://httpd.apache.org/docs/2.4/custom-error.html 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>
Testing Developers Search Plugins Popular Tags widget (6,053) Post (3,730) plugin (3,707) admin (3,195) posts (2,843) shortcode (2,510) sidebar (2,254) google (2,132) twitter (2,086) page (2,082) images (2,031) comments (1,940) woocommerce (1,940) More » Custom Error Pages Create custom 401 and 403 error https://wordpress.org/plugins/custom-error-pages/ pages with any WordPress theme without writing a single line of code, set it http://serverfault.com/questions/331833/custom-403-error-page-not-showing up and forget it. Download Version 1.1 Description Installation FAQ Screenshots Changelog Stats Support Reviews Developers WordPress offers inbuilt support for custom 404 pages on all themes. But what about custom pages for other common errors like 401 and 403? You end up seeing a bland error page of the Web Server. With this plugin you error page can easily create custom 401 and 403 error pages with any theme without writing a single line of code!!! And the best part is that you set it and forget it. Yes, you don't have to do any changes even if you change themes. The heading and text you want on 401 and 403 error pages are displayed on the currently active theme. Further Reading Create WordPress 401 and 403 error page 403 error pages WITHOUT using this plugin The Custom Error Pages Plugin official homepage. Tags: 401, 403, 404, error, errors, htaccess, http Requires: 3.3.0 or higher Compatible up to: 4.6.1 Last Updated: 2 months ago Active Installs: 1,000+ Ratings 5 out of 5 stars 5 stars 6 4 stars 0 3 stars 0 2 stars 0 1 star 0 Author Jesin A 4 plugins Support 0 of 1 support threads in the last two months have been marked resolved. Got something to say? Need help? View support forum Translations Translate Custom Error Pages Compatibility WordPress 4.6.1 4.6 4.5.4 4.5.3 4.5.2 4.5.1 4.5 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4 4.3.6 4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.2.4 4.2.3 4.2.2 4.2.1 4.2 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 4.1.2 4.1.1 4.1 4.0.13 4.0.12 4.0.11 4.0.10 4.0.9 4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0 3.9.14 3.9.13 3.9.12 3.9.11 3.9.10 3.9.9 3.9.8 3.9.7 3.9.6 3.9.5 3.9.4 3.9.3 3.9.2 3.9.1 3.9 3.8.16 3.8.15 3.8.14 3.8.13 3.8.12 3.8.11 3.8.10 3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 3.8.2 3.8.1 3.8 3.7.16 3.7.15 3.7.14 3.7.13 3.7.12 3.7.11 3.7.10 3.7.9 3.7.8 3.7.7 3.7.6 3.7.5 3.7.4 3.7.3 3.7.2 3.7.1 3.7 3.6.1 3.6 3.5.2 3.5.
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 Custom 403 Error page not showing up vote 1 down vote favorite I want to restrict access to certain folders (includes, xml and logs for example) and so I've given them 700 permissions, and all files within them 600 permissions. Firstly, is this the right approach to restrict access? I have a .htaccess file in my root that handles rewriting and error documents. There are two pages in the root - 403.php and 404.php - for 403 and 404 errors. And I have these rules added to my .htaccess file: ErrorDocument 404 /404.php ErrorDocument 403 /403.php Now, the 404 page works just fine. The 403 page does not show when I try to access the 'includes' folder - I get the standard apache 403 error page instead, saying 'Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.' However, when I try going to the .htaccess file (in the web root) in my browser, I get my custom 403 error page. Why is this happening? apache-2.2 .htaccess http-status-code-403 custom-errors share|improve this question asked Nov 17 '11 at 5:04 Rahul Sekhar 12615 What are you trying to restrict access from - web requests? Who's the owner of the files? As far as the ErrorDocument directives not applying, is the .htaccess file in a parent directory of your includes directory? –Shane Madden♦ Nov 17 '11 at 6:12 Yes, from web requests. The .htaccess is in a parent folder. It's in the root folder - the includes directory is one of the subfolders there. Ideal would be to place the includes out of the web root I'm sure, but I have no need of very strict security. I'd just like to have some basic restrictions in place. –Rahul Sekhar Nov 17 '11 at 10:43 add a comment| 1 Answer 1 act