0

我正在尝试更改这些:

http://www.ltv.com/iloveu/health/contraceptionsurvey/

http://www.ltv.com/iloveu/health/contraception-special/

 location ~* ^/iloveu/health/contraceptionsurvey/?$ {
        rewrite ^ /ilo`enter code here`veu/health/ permanent;
    }

    location ~* ^/iloveu/health/contraception-special/?$ {
        rewrite ^ /iloveu/health/ permanent;

}

使用我创建的这个表达式:

%s/http:\/\/www\.ltv\.com\(.*\)/location ~\* \^\& \{ \r\t rewrite \^ \/iloveu\/health\/ permanent; \r }\r/g

但似乎没有得到想要的输出。

4

1 回答 1

1
%s#http://www\.ltv\.com\(.*\)#location \~* ^\1?$ \{ \r\t rewrite ^ /iloveu/health/ permanent; \r }\r#g

\&获取匹配的整个字符串,而不仅仅是括号中的部分,您可以使用\1.

于 2012-08-10T16:45:33.710 回答