htaccess mod 重写将 http://www 更改为 http://www
我想将这样的调用替换为:
www.mysite.com/sub/file.php?param1=x¶m2=http://www.someurl.com
为:
www.mysite .com/sub/param1/param2
Param 1 是一个整数 Param 2 是一个 url
我在 htaccess 中编写了这个重写规则:
RewriteCond %{REQUEST_URI} \/sub\/
RewriteRule sub\/([0-9]+)\/(.*)$ sub\/file.php?param1=$2¶m2=$1 [L]
不幸的是 param2 (URL)以 http:/www.someurl.com 开头
而不是 http://www.someurl.com
(注意单斜杠)。
知道是什么原因造成的吗?当我以 www.mysite.com/sub/file.php?param1=x¶m2=http://www.someurl.com
格式调用具有相同参数的同一文件时,param2 确实出现好的,所以它一定是带有重写规则的东西。
I want to replace calls like this:
www.mysite.com/sub/file.php?param1=x¶m2=http://www.someurl.com
with:
www.mysite.com/sub/param1/param2
Param 1 is an integer number Param 2 is a url
I wrote this rewrite rule in htaccess:
RewriteCond %{REQUEST_URI} \/sub\/
RewriteRule sub\/([0-9]+)\/(.*)$ sub\/file.php?param1=$2¶m2=$1 [L]
Unfortunately param2 (the URL) starts with http:/www.someurl.com
instead of http://www.someurl.com
(note the single slash).
Any idea what causes it? When I call the same file with same parameters in the format www.mysite.com/sub/file.php?param1=x¶m2=http://www.someurl.com
, param2 does appear OK so it must be something with the rewrite rule.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要从THE_REQUEST中获取值:
You need to grab the value from THE_REQUEST: