开发者

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

开发者 https://www.devze.com 2023-02-15 03:50 出处:网络
I have the following url which i want to write a helicon Rewrite开发者_StackOverflow社区Rule rule

I have the following url which i want to write a helicon Rewrite开发者_StackOverflow社区Rule 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号