lativo
lativo

Reputation: 35

whats wrong with this redirect rule?

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 REDIRECTS, this phenomenon ocurs.

Upvotes: 1

Views: 159

Answers (1)

Jaskirat
Jaskirat

Reputation: 1094

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.

Upvotes: 1

Related Questions