繁体   English   中英

没有网址更改,从一个域重定向到另一个域

[英]Without Url Change redirect from one domain to another domain

我想将一个域重定向到另一个域,但不更改URL。

例如:

ADomain.com redirect to BDomain.com/xxx/xxx/xxx/?xxx=xxxx

我尝试过一些htaccess

RewriteCond %{HTTP_HOST} ^(www\.)?ADomain\.com$ [NC]
RewriteRule ^(.*)$ http://BDomain.com/xxx/xxx/xxx/?xxx=xxx [R,L,NC]

此代码已完美重定向。 但这会将当前的浏览器URL( ADomain.com )更改为原始链接( BDomain.com/xxx/xxx/xxx/?xxx=xxxx )。 但我不需要。 我只想保留网址ADomain.com。 请任何人指导我。 谢谢提前

将此PHP代码添加到index.php

<?php

function dwn_prt($url,$user_agent='Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)') 
{ 
$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); 
curl_setopt ($ch, CURLOPT_HEADER, 0); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_REFERER, 'http://ADomain.com');
$result = curl_exec ($ch); 
curl_close ($ch); 
return $result; 
}
  echo dwn_prt('http://BDomain.com/xxx/xxx/xxx/?xxx=xxxx');
?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM