Detailed description of the. htaccess Rewrite rulesAuthor Freemouse July 22, 2010With Apache virtual host a lot of friends, Apache provides. The htaccess module can set rewrite rules for each virtual host, which is useful for SEO optimization of the
http://lesca.me/archives/htaccess-rewrite.html/comment-page-1#comment-16045
Catalog Table of Contents First, ready to start: Mod_rewrite. htaccess implements URL rewriting (rewrite) and URL redirection (redirect) to map an. htm page to a. PHP
Domestic virtual machines are generally not available. htaccess function (as far as I know, Discuz's host seems to provide this function), while in foreign hosts,. htaccess function seems to be standard, the author of the blog frame on MT, support.
1. htaccess File Use premise
The main role of htaccess is to implement URL rewriting, that is, when the browser access to a server folder through the URL, as the owner, we can receive the URL, how to receive it, is the role of this document. All
Between management introduction
Apache Module Mod_rewriteAn engine that describes a real-time rewrite URL request based on a certain ruleState extension (E)Module name Rewrite_moduleSource file mod_rewrite.cCompatibility is available only in Apache
The Mode Rewrite module of Apache provides a Rewrite engine based on regular expression analyzer to Rewrite URL requests in real time.
Manager Introduction
Apache module mod_rewriteDescribes an engine for real-time URL rewriting requests based on
Nginx in the use of pseudo static is directly in the nginx.conf write rules, do not need to be like Apache to open the Write module (mod_rewrite) in order to perform pseudo static.
Nginx only need to open the nginx.conf configuration file, write
. htaccess set the order of the site's default home page
Add the following line to the. htaccess file:
The code is as follows
Copy Code
DirectoryIndex index.html index.htm index.php
Htaccess set 404 Error page
Htaccess is a convenient pseudo-static rule for friends who do not have server permissions or have one server running N sites.
. Htaccess sets the default homepage order of a website
Add the following lines to the. htaccess file:
The Code
What is htaccess
As an overview, the htaccess file is a configuration file in the Apache server that is responsible for the page configuration in the related directory. Through the htaccess file, you can help us achieve: Web 301 redirect, custom 404
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.