following data within the. htaccess:ErrorDocument 404 http://localhost/error/notfound.htm ErrorDocument can also be followed by a paragraph of text or directly specify a section of HTML syntax, but, Text or HTML must be the same line as ErrorDocument. When you can't find the page, you want to display the text, and you can add the following data to the. htaccess:ErrorDocument 404 "page Not found!!" when the
When apache was configured to connect to JBoss this evening, it was found that Apache's static files could be accessed, but dynamic files could not be accessed. I checked it online. Most of them are in the httpd. conf file.Options followsymlinks
scripts.
# Format: Action media/type/cgi-script/location
# Format: Action handler-name/cgi-script/location
#
#
# There are three different styles of configurable error response:
# 1) Plain text 2) local redirects 3) external redirects
#
# Some examples:
# errordocument "The server made a boo boo."
# ErrorDocument 404/missing.html
# errordocument 404 "/cgi-bin/m
-script/location
# Format: Action handler-name/cgi-script/location
#
#
# There are three different styles of configurable error response:
# 1) Plain text 2) local redirects 3) external redirects
#
# Some examples:
# errordocument "The server made a boo boo."
# ErrorDocument 404/missing.html
# errordocument 404 "/cgi-bin/missing_handler.pl"
#
use are limited. The administrator can set it through the Apache allowoverride directive.
-directives in subdirectories overwrite instructions in higher-level directories or primary server configuration files.
-. htaccess must be uploaded in ASCII mode, preferably with the permissions set to 644.
Locating the wrong document
Common Client Request error return code:
401 Authorization Required
403 Forbidden
404 Not Found
405 Method Not allowed
408 Request Timed out
411 Content Length Required
?post_id=$1
Rewriterule ^u-(Username|uid)-(. +) \.html$ space.php?$1=$2
Where rewriteengine represents the opening URL rewrite, rewriterule is the overriding rule.
V. Configuration Error page
The basic syntax is as follows:
Copy Code code as follows:
# Custom Error Documents
ErrorDocument 401/err/401.php
ErrorDocument 403/err/403.php
Err
GET.ServerGenerally, some standard HTTP header information is sent to the browser. To add additional information, you need to use MetaDir to define the directory where Meta data is stored, metaS uffix is used to specify the file suffix that contains Meta data.
# ErrorDocument 500 "The server made a boo.# ErrorDocument 404/missing.html# ErrorDocument 404/cgi-bin/
need to define a MIME type first. #MetaDir. The Web #MetaSuffix. Meta Meta information is pre-sent to the customer's browser some data before the document is sent to the customer, so the browser can access the meta information through the head request without actually returning all the document data through get. The server is usually sent to the browser is some standard HTTP header information, if you want to add additional information, you need to use Metadir toDefines the directory where the
information is pre-sent to the customer's browser before the document is sent to the customer. Therefore, the browser can access the Meta information through the HEAD request without actually returning all the document data through GET. The server usually sends some standard HTTP header information to the browser. To add additional information, you need to use MetaDir to define the directory where Meta data is stored, metaS uffix is used to specify the file suffix that contains Meta data. #
data, and Metas Uffix to specify the file suffix containing meta data.
#ErrorDocument "The server made a boo boo.
#ErrorDocument 404/missing.html
#ErrorDocument 404/cgi-bin/missing_handler.pl
#ErrorDocument 402
Http://some.other_server.com/subscription_info.html
If a customer requests a Web page that does not exist, o
|png|gif) $ hotlink.jpeg [nc,r,l]
You can change the domain URL address to an image path, but you need to end with JPG, PNG, and GIF. Otherwise, the rules will be used again to cause a dead loop to the server. I recommend using. jpeg to solve this problem. Here R Mark replaces F to send a turn.
2. Block user via IP address
If there is a lot of spam on the Web site, you can block users by IP address. You can find their IP in the log file, just add the IP address to the htaccess file.
Order De
information, you need to use Metadir to define the directory of Meta data, and Metas Uffix to specify the file suffix containing meta data.
#ErrorDocument "The server made a boo boo.
#ErrorDocument 404/missing.html
#ErrorDocument 404/cgi-bin/missing_handler.pl
#ErrorDocument 402
Http://some.other_server.com/subs
the visitor to an error page and find: # Customizable error responses come in three flavors: #1) plain text 2) local redirects 3) external redirects # Some examples: # ErrorDocument 500 "The server made a boo. "# ErrorDocument 404/missing.html # ErrorDocument 404"/cgi-bin/missing_handler.pl "# ErrorDocument 402 http:/
AuthUserFile c: \ ss refers to the file location (. htpasswd) for saving the user name and password. In this example, it refers to the. htpasswd file, which is in the same location as our. htaccess file.
Require valid-user specifies that only valid users in the. htpasswd file can access the service.1.1.2. htpasswd Configuration
User name: Password
Aaa: aaa
Not necessarily in. the configuration in the htaccess file can also be found in httpd. conf (Master configuration) to improve the efficienc
Method One
The code is as follows
Copy Code
@header ("http/1.1 404 Not Found");@header ("status:404 not Found");echo ' echo 404 ';Exit ();
Load a 404 error page
The code is as follows
Copy Code
@header ("http/1.1 404 Not Found");@header ("status:404 not Found");Include (".. /.. /404.htm ");Exit ();
You can also add the. htaccess code as follows
The code is as follows
Copy Code
). Modify the default home page
When you access the directory, Apache automatically imports the home page, prioritized in order of precedence
Change the DirectoryIndex index.html Index.html.var to
DirectoryIndex index.html index.jsp index.php default.jsp default.php
(4). Set error page
This will be more secure for your site, if not set, others in your URL after the random input a path, will show 404 wrong
Wrong, and will display your server version number, server configuration at a glance, in or
Timed out411 Content Length Required412 Precondition Failed413 Request Entity Too Long414 Request URI Too Long415 Unsupported Media TypeCommon Server error return code:Internal Server Error
Users can use. htaccess to specify their own prepared Error alert page. In general, people can set up a directory specifically, such as errors to place these pages. And then again. htaccess, add the following instructions:
ErrorDocument 404/errors/notfound.htmlErr
AddHandler to associate the processing operation with the file suffix, but instead uses the action to process MIME-type files directly. However, if the document suffix does not have a formal MIME type, you need to first define a MIME type.
#ErrorDocument "The server made a boo boo.
#ErrorDocument 404/missing.html
#ErrorDocument 404/cgi-bin/missing_handler.pl
#
server usually sends some standard HTTP header information to the browser. To add additional information, you need to use MetaDir to define the directory where Meta data is stored, metaS uffix is used to specify the file suffix that contains Meta data.
# ErrorDocument 500 "The server made a boo.
# ErrorDocument 404/missing.html
# ErrorDocument 404/cgi-b
Action to define a pre-processing operation for a MIME type.
You need to set the Action parameter in the first format in the example. In this way, no additional AddHandler is required to associate the processing operation with the file suffix. Instead, Action is used to directly process MIME-type files. However, if the document suffix does not have a formal MIME type, you must first define a MIME type.
# MetaDir. web
# MetaSuffix. meta
Meta information is sent to the client browser in adva
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.