Example of apache rewrite Rules

Source: Internet
Author: User
Tags http redirect

 RewriteRule ^itnews/([-]{})/([-]{})([-]{})/([^/_]*)_([-]+).html$ http:  RewriteCond %{REQUEST_FILENAME} ^http: RewriteCond %{DOCUMENT_ROOT}% !- RewriteRule ^http:  RewriteCond %{REQUEST_FILENAME} ^http: RewriteCond %{DOCUMENT_ROOT}% !- RewriteRule ^http:  RewriteCond %{REQUEST_FILENAME} ^http: RewriteCond %{DOCUMENT_ROOT}% !- RewriteRule ^http:

Function to jump http://www.test.com/itnews/2013/0101/phone_12354.html to http://www.test.com/news/201301/ (33 | 11 | 12316_12354.html

Some questions:

1. flags [

2. After the flags [chain | C] Jump

 

RewriteCond %{REQUEST_FILENAME} !-^news/([-]{})/12_([-]+).html$  http:RewriteCond %{REQUEST_FILENAME} ^http:RewriteCond %{DOCUMENT_ROOT}% !-^http:

3.

^content-([-]+)-([-]+)-([-]+).html index.php?m=content&c=index&a=show&catid=$&id=$&page=$^content-([-]+)-([-]+)-([-]+).html  http:

Because the apache configuration environment or relative path is different.

(RewriteCond %{REQUEST_FILENAME} !- non-regex pattern  

 

RewriteCond %{QUERY_STRING} ^a=(.*^test1.php$  http:

 

 

 

Http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

Quick query table:

RewirteRule flag Description Description
R Redirect Issue an HTTP redirect
F Forbidden Prohibit Access to URL addresses
G Gone The specified URL does not exist.
P Proxy Pass the URL address to mod_proxy
L Last Stop processing the following rules
N Next Processing starts from the first rule again, but uses the URL address after the current rewriting.
C Chain Link the current rule with the rule that follows.
T Type MIME class specified for Force Execution
NS Nosubreq Use this rule only when no internal sub-requests are executed
NC Nocase URL matching is case sensitive.
QSA Qsappend Append the query string after the new URL address, instead of replacing
PT Passthrough Pass the rewritten URL address to another Apache module for further processing.
S Skip Ignore rules
E Env Set Environment Variables

 

 

 

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.