开发者

Not beginning with https://

I want to redirect request to other url if and only if the url is not beginning with https://

I just need the pattern. The pattern I use is:

^(.*)$

But this redirects user even if 开发者_运维技巧the url is beginning with https://

What condition should add in above pattern?


I'm pretty sure just make it ^(https.*)$


I think this is the pattern you want to use:

^(?!https://)

This means "at the beginning of the string, check that the next characters to come up are not https://". Be sure that your regex system supports this feature called lookaheads, though!


The answer to this question is extremely elementary.

Please read the following. http://www.regular-expressions.info/tutorialcnt.html

Specifically, http://www.regular-expressions.info/charclass.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜