简体   繁体   中英

Helicon ISAPI rule to rewrite a old url to new one and check query string pattern

I have the following url which i want to write a helicon RewriteRule rule it should check the pattern startat=/mypage.asp and then only execute

Original url

http://www.test.com/welcome.asp?startat=/mypage.asp&value1=23&value2=3434&value3=1&value4=someothervalue

the new url

http://www.test.com/mynewpage.hcx?startat=/mypage.asp&value1=23&value2=3434&value3=1&value4=someothervalue

as i am new to helicon and regex ,can someone help me

appreciate your help

something like:

RewriteRule ^/welcome.asp(.+)$ /mynewpage.hcx$1 [RP]

Will match any url starting with /welcome.asp, and $1 will contain the rest of the url.

Not sure about the [] part, but RP is permanent redirect (aka, 301)

EDIT: You could try this:

RewriteRule ^/welcome.asp(. startat=/mypage.asp. )$ /mynewpage.hcx$1 [RP]

.* <- 0 or more chars .+ <- 1 or more chars

so basically it translates to: start with /welcome.asp, 0 or more chars followed by "startat=/mypage.asp", followed by 0 or more chars until end of url.

Redirect to mynewpage.hcx followed by any content from the first paranthesis.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM