Home  >  Article  >  Backend Development  >  .htaccess怎么解决网站首页url的有关问题

.htaccess怎么解决网站首页url的有关问题

WBOY
WBOYOriginal
2016-06-13 13:02:17626browse

.htaccess如何解决网站首页url的问题
.htaccess如何解决网站首页url的问题

我网站首页有一个这样的地址:
暂定为我的网站域名为 A(www.a.com)
另外有一个网站域名为 B(www.b.com)

现在我的网站首页地址有一个 A/?from=B

请问如何设置.htaccess url重写将地址重定向为正常状态

我自己写了一个:

RewriteRule ^(.*)\?www\.b\.com?$ http://www.a.com/$1 [R=301,L]  但是不起作用
请问应如何设置?
------最佳解决方案--------------------
http://www.localzend.com/?from=http://www.baidu.com


RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{QUERY_STRING} ^from=(.*)
RewriteRule ^(.*)$ a.php?a=%1 [L]

但是需要借助a.php中设置header来跳转。


------其他解决方案--------------------

引用:
http://www.localzend.com/?from=http://www.baidu.com
PHP code

RewriteCond  %{REQUEST_URI} ^(.*)$
RewriteCond  %{QUERY_STRING} ^from=(.*)
RewriteRule ^(.*)$  a.php?a=%1 [L]


但是需要借助a.php中设置header来跳转……


可以用了!!!谢谢您!!!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn