Home > php教程 > php手册 > body text

php header实现不传权重的网址跳转

WBOY
Release: 2016-05-25 16:45:55
Original
1065 people have browsed it

网址的跳转最常用的就是在黄页类,淘宝客类等有很多外部链接的网站上使用,避免大量外链降低网站自身的权重,这里列举几个跳转方法.

网上最常见的一种方法:

<?php 
$url = $_GET[&#39;url&#39;];  
Header("Location:$url");  
?>
Copy after login

把这段代码放到一个文件夹,命名为 比如go.php,然后go.php?url=需要跳转的网址,如果需要跳转淘宝客等产品链接,由于带有参数,需要修改下代码,用如下的代码:

<?php 
$qstring = $_SERVER[&#39;QUERY_STRING&#39;]; 
$url  = substr($qstring,4); 
header("Location: $url"); 
?>
Copy after login

另外还有很多js html的代码等等,就不介绍了,有需要的网上搜索一大把.


本文地址:

转载随意,但请附上文章地址:-)

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!