100 points • Beg Isapi_rewrite Rewrite rules

Source: Internet
Author: User
htaccess pseudo-static rules

Format: request address → Destination address
1,/abc123.htm→/index.php?page=abc123
2,/a/xxxx→/a/index.php?id=xxxx
3,/b/xxxx→/b/index.php?id=xxxx
4,/xxxx.html?id=123&ty=aaa→/index.php?page=xxxx&id=123&ty=aaa

Ask the great God to write Isapi_rewrite jump rules, to achieve the above jump demand.


Urgent "Urgent" "" "


Reply to discussion (solution)

rewriterule^ (. *)/ABC (. *). html$ $1/index\.php?page=abc$2rewriterule^ (. *)/a/(. *) $ $1/a/index\.php?id=$2rewriterule ^ (. *)/b/(. *) $ $1/b/index\.php?id=$2rewriterule^ (. *)/(. *). html?id= (. *) &ty= (. *) $  $1/index\.php?page=$2 &id=$3&ty=$4

You give it a try

rewriterule^ (. *)/ABC (. *). html$ $1/index\.php?page=abc$2rewriterule^ (. *)/a/(. *) $ $1/a/index\.php?id=$2rewriterule ^ (. *)/b/(. *) $ $1/b/index\.php?id=$2rewriterule^ (. *)/(. *). html?id= (. *) &ty= (. *) $  $1/index\.php?page=$2 &id=$3&ty=$4

You give it a try



In the last rule, the ID and Ty are not fixed because similar URLs are more, some are IDs, some are not IDs.


rewriterule^ (. *)/ABC (. *). html$ $1/index\.php?page=abc$2rewriterule^ (. *)/a/(. *) $ $1/a/index\.php?id=$2rewriterule ^ (. *)/b/(. *) $ $1/b/index\.php?id=$2rewriterule^ (. *)/(. *). html?id= (. *) &ty= (. *) $  $1/index\.php?page=$2 &id=$3&ty=$4

You give it a try



In the last rule, the ID and Ty are not fixed because similar URLs are more, some are IDs, some are not IDs.



Rewriterule ^ (. *)/(. *). html? (. *) = (. *) & (. *) = (. *) $ $1/index\.php?page=$2&$3=$4&$5=$6



rewriterule^ (. *)/ABC (. *). html$ $1/index\.php?page=abc$2rewriterule^ (. *)/a/(. *) $ $1/a/index\.php?id=$2rewriterule ^ (. *)/b/(. *) $ $1/b/index\.php?id=$2rewriterule^ (. *)/(. *). html?id= (. *) &ty= (. *) $  $1/index\.php?page=$2 &id=$3&ty=$4

You give it a try



In the last rule, the ID and Ty are not fixed because similar URLs are more, some are IDs, some are not IDs.



Rewriterule ^ (. *)/(. *). html? (. *) = (. *) & (. *) = (. *) $ $1/index\.php?page=$2&$3=$4&$5=$6



or invalid, jump directly to the index.php, the following parameters are not attached on

The last rule I explain:
Is that I requested a/xxxx.html?id=123&ty=aaa where xxxx is the page name page, followed by? With the addition of ID=123&TY=AAA parameters, the parameters are variable, and these parameters need to be appended to the destination URL, i.e., index.php? page=xxxx& back
Page is also a parameter of the target page, passing the name of the current request page, that is, XXXX.

is actually trying to put/XXXX.HTML?ID=123&TY=AAA in this request "xxxx.html?" Partially replaced by "index.php?mod=xxxx&"

is actually trying to put/XXXX.HTML?ID=123&TY=AAA in this request "xxxx.html?" Partially replaced by "index.php?mod=xxxx&"


Rewriterule ^ (. *)/(. *). html? (. *) $ $1/index\.php?mod=$2&$3


is actually trying to put/XXXX.HTML?ID=123&TY=AAA in this request "xxxx.html?" Partially replaced by "index.php?mod=xxxx&"


Rewriterule ^ (. *)/(. *). html? (. *) $ $1/index\.php?mod=$2&$3



or jump invalid, a few other rules can jump normally, where should I troubleshoot the problem?

The problem still exists, and someone can point out

Rewriterule ^ (. *)/(. *). html? (. *) $ $1/index\.php?page=$2

Rewriterule ^ (. *)/(. *). html? (. *) $ $1/index\.php?page=xxxx
Rewriterule ^ (. *)/xxx.html? (. *) $ $1/index\.php?page=xxxx

Rewriterule ^ (. *)/xxx.html? (. *) $ $1/index\.php\?page=xxxx

Rewriterule ^ (. *). html\? (. *) $ index.php?mod=$1&$2

Thanks for two upstairs, I found the answer myself.

/XXXX.HTML?ID=123&TY=AAA matching rules are as follows
Rewritecond%{query_string} ^id= (. +) &ty= (. +) $
Rewriterule xxxx\.html$ index\.php\?page=xxxx&id=%1&ty=%2 [L]

This rule can match the URL with the parameter after the HTML.

  • Related Article

    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.