Redirect jumps to external links of the website

PHP中文网
Release: 2023-02-28 22:54:02
Original
2420 people have browsed it

In the comment function of Emlog, the commenter can fill in his or her website address. But many times we don’t want our website to have too many cluttered external links. Of course, we can add the nofollow attribute to the link. That is to say, the original link code is

<a href="http://www.php.cn">一路上</a>
Copy after login

When we add the rel="nofollow" attribute to this link, we tell the search engine not to pass the weight of this link address. It looks like:

<a href="http://www.php.cn" rel="nofollow">一路上</a>
Copy after login

And here, what I shared with you along the way is to redirect the external link address. That is, if the external link address is http://www.php.cn, through redirection, it becomes http://your website address/go.php?url=http://www.php.cn and it is still accessed Target website http://www.php.cn

First download the go.zip file, extract the go.php file and upload it to the root directory of your website, and then add http://www.php.cn in go.php Replace with your website address. Finally, you only need to replace the link address you want to convert from

<a href="&#39;.$comment[&#39;url&#39;].&#39;" target="_blank">

Replace it with:

to complete the redirection conversion of the Emlog blog commenter URL link. Further, you can also redirect the URL link of the Emlog blog commenter. Open robot.txt and add the following code to prevent redirected external links from being indexed by search engines: Disallow: /go.php?url=*

Additional note: Open go.php, you can also set whether it is Direct jump, if $directGo is set to false, a frame will be used to load the external link web page.

The above introduces the redirection jump for the external link of the website, including the relevant content. I hope that friends who are interested in PHP tutorials will have it. Helped.

Related articles:

Three methods of php page redirection

The difference between PHP redirection and pseudo-static

Summary of two methods of JavaScript redirection URL parameters

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