Explain the functional wording of the Apache. htaccess file

Source: Internet
Author: User
Tags error code html page return

The function of the. htaccess file in Apache

-The. htaccess file (or distributed configuration file) provides a way to configure changes to the directory, that is, to place a file containing one or more directives in a specific document directory to function in this directory and all its subdirectories. As a user, the commands you can 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

412 Precondition Failed

413 Request Entity Too Long

414 Request URI Too Long

415 Unsupported Media Type

Common 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.html

ErrorDocument 500/errors/internalerror.html

A single line of instructions. The first instruction above means that the page is displayed as a notfound.html page in the/errors directory for 404, which is when the required document is not found. It is not difficult to see that the syntax format is:

ErrorDocument error code/directory name/filename. extension

If you need to be prompted with very little information, you don't have to create a page to use the HTML number directly in the instruction, such as the following example:

ErrorDocument 401 "<body bgcolor= #ffffff >



Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.