Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccessurl屏蔽_.htaccess_Url_Masking - Fatal编程技术网

.htaccess htaccessurl屏蔽

.htaccess htaccessurl屏蔽,.htaccess,url,masking,.htaccess,Url,Masking,嘿,我是一个有着htaccess的完全的niewbie。 在我的站点(mysite.com)上,我得到了一个链接,该链接将变量定向并发送到安全站点(othersite.com/somepage.php?urlink='www.mysite.com')上的页面 如何编辑htaccess文件以将othersite.com/somepage.php?urlink='www.mysite.com'重写为urlink具有的任何值 我在我的htaccess中有这个 Options +FollowSymlin

嘿,我是一个有着htaccess的完全的niewbie。 在我的站点(mysite.com)上,我得到了一个链接,该链接将变量定向并发送到安全站点(othersite.com/somepage.php?urlink='www.mysite.com')上的页面

如何编辑htaccess文件以将othersite.com/somepage.php?urlink='www.mysite.com'重写为urlink具有的任何值

我在我的htaccess中有这个

Options +FollowSymlinks<br>
Options All -Indexes<br>
Options Indexes Includes FollowSymLinks ExecCGI
RewriteEngine on
RewriteRule ^&urlink=(.*) http://$1 [P]
Options+FollowSymlinks
选项所有-索引
选项索引包括以下SYMBOLINKS ExecCGI 重新启动发动机 重写规则^&urlink=(*)http://$1[P]
好奇。认为这样做行不通;如果您在其他服务器上请求页面,您自己的htaccess将不会为您提供解决方案。(如果您自己有权访问/拥有othersite.com,他们的htaccess可以做到这一点)

相反,我会编写一个小PHP文件,使用HTTP_头重定向到otherside.com。 因此,您可以告诉htaccess隐藏php Url

我对你的问题理解得对吗

<?php
$myInputURL = $my_POSTURL;
$myOtherSite = "http://www.otherside.com?urllink=";
$myURL = $myOtherSite . $myInputURL;
header("Location: ".$myURL);
?>  

重写规则不能像那样直接处理查询字符串

例如,如果URL是
http://www.example.com/kitten.php?say=meow
,则RewriteRule只能匹配
kitten.php
部分。其他所有内容都可以通过RewriteCond进行匹配,例如:
RewriteCond%{QUERY\u STRING}^urlink=(*)

请参阅文件:


在您的情况下,它可能是这样的(对不起,我不知道您到底想要实现什么,因此我只是编辑您现有的规则):


我确实可以访问othersite.com。我提供的htaccess位于othersite.com上。感谢大家的帮助。这就是我想做的。每当翻页时“则必须在地址barno中显示www.mysite.com。我有一个产品页面,但要查看购物车,你必须去。我想要的是购物车页面url像这样显示产品页面的url。看起来似乎是不可能的。在这种情况下,你必须采取其他方法:当用户进入
www.mysite.com/view\u cart.php
时,你会显示
amazingbiz.co.za/eshop/…
——这就是如何在地址栏中保持你想要的
www.mysite.com
。您可以尝试使用反向代理执行此操作(为此搜索更多)。。或者在PHP脚本中获取
amazingbiz.co.za/eshop/…
的内容(使用
curl.*
函数)并显示为您自己的页面。你真的必须测试它——我认为这不会很容易实现。
Options Indexes Includes FollowSymLinks ExecCGI
RewriteEngine on

RewriteCond %{QUERY_STRING} ^urlink=(.+)$
RewriteRule ^somepage\.php$ http://%1 [P]