开发者

Mod_rewrite with "http://" in Querystring

I'm trying to create a rewrite rule that will do the following:

http://www.example.com/http://other.example.comhttp开发者_StackOverflow社区://www.example.com/index.php?var=http://google.com

This is my current rule:

RewriteCond %{REQUEST_URI} ^/(http[s]?\:\/\/|ftp\:\/\/)?(www\.)?[a-zA-Z0-9-\.]+\.(com|org|net|mil|edu|ca|co.uk|com.au|gov|ws|info)$
RewriteRule ^(.*)$ http://www.example.com/index.php?var=$1 [R]

Which produces:

http://www.example.com/http://google.comhttp://www.example.com/index.php?var=http:/google.com

No matter what I try, I'm always getting http:/ out, instead of http://. Any ideas?


Apache removes empty path segments like the one in http://. So /foo//bar/// is interpreted like /foo/bar/. But the original request line in THE_REQUEST remains unchanged:

RewriteCond %{THE_REQUEST} ^GET\ /(https?://[^\ ]+)
RewriteRule ^https?:/ /index.php?var=%1 [R]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜