从$ _GET网址URL = HTTP:?//google.com [英] $_GET URL from ?url=http://google.com

查看:232
本文介绍了从$ _GET网址URL = HTTP:?//google.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个重定向脚本,我的网站,我使用htaccess的重写URL,这样它看起来更好。

I'm making a redirect script for my site, I use htaccess to rewrite the URL so it looks nicer.

如。 的http://本地主机/ R / HTTP://google.com 是URL,但是当我打印的价值它显示了这样的 HTTP :/google.com
。 其中 / 丢失,我该如何解决呢?

eg. http://localhost/r/http://google.com is the URL, but when I printing the value it shows up like this http:/google.com.
One / is missing, how can I fix that?

编辑:
重写规则:
重写规则^ R /(.*)/$ /system/offsite/redirect/index.php?url=$1 [L]


Rewrite rule:
RewriteRule ^r/(.*)/$ /system/offsite/redirect/index.php?url=$1 [L]

感谢您的帮助:)

推荐答案

此行​​为是由于给Apache删除空路径段映射之前。但是你可以通过访问原始请求的URI路径的 THE_REQUEST 的:

This behavior is due to Apache that removes empty path segments before mapping it. But you can access the original requested URI path via THE_REQUEST:

RewriteCond %{THE_REQUEST} ^GET\ /r/([^\ ]+)
RewriteRule ^r/ /system/offsite/redirect/index.php?url=%1 [L]

这篇关于从$ _GET网址URL = HTTP:?//google.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆