开发者

whats wrong with this redirect rule?

开发者 https://www.devze.com 2022-12-09 13:34 出处:网络
RewriteCond %{REQUEST_URI} !^/?cgi-bin/nph-proxy.cgi/000100A/http/ RewriteRule (.*) /cgi-bin/nph-proxy.cgi/000100A/http/$0
RewriteCond %{REQUEST_URI} !^/?cgi-bin/nph-proxy.cgi/000100A/http/
RewriteRule (.*) /cgi-bin/nph-proxy.cgi/000100A/http/$0

i am trying to redirect

www.myproxysite.com/somedomain.com/somedir/specialchar

to

www.myproxiste.com/cgi-bin/nph-proxy.cgi/000100A/http/somedomain.com/somedir/specialchar

instead it keeps going to

www.myproxiste.com/000100A/http/somedomain.com/somedir/specialchar

which of course doesn't work.

EDIT: I discovered that when somedomain.com 301 REDIRE开发者_如何学编程CTS, this phenomenon ocurs.


Try this

RewriteCond %{HTTP_HOST} ^(www.)?myproxysite.com$ [NC]
RewriteRule ^(?!/cgi-bin/nph-proxy.cgi/000100A/http)(.*)$ http://www.myproxysite.com/cgi-bin/nph-proxy.cgi/000100A/http/$1 [L,R=301]

Actually I dont really know the usage of REQUEST_URI as I have not really read mod rewrite rules. But based on what i know , i think the above should achieve what you want.

UPDATE: Maybe you should just try using $1 instead of $0 in your code.

0

精彩评论

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

关注公众号