REDIRECT jumps to the Web site's external chain

Source: Internet
Author: User
In the Emlog comment function, the message person can fill in the website address. But there are times when we don't want to have too many cluttered external links on our site. Of course, we can add the nofollow attribute to the link. That is, the link code is

<a href= "http://www.php.cn" > Along the Journey </a>

When we add the rel= "nofollow" attribute to this link, we tell the search engine that the link address does not pass the weight. Shaped like:

<a href= "http://www.php.cn" rel= "nofollow" > Along the Journey </a>

And here, along the journey with you, is to redirect the address of the outside chain. That is, if the outer chain address is http://www.php.cn, through redirection, it becomes http://Your website address/go.php?url=http://www.php.cn still visit the target site http://www.php.cn

First download the Go.zip file to extract the go.php file to the root directory of your website, and then replace the http://www.php.cn in go.php with your website address. Finally, you only need to change the link address in your website from <a href= "Http://XXXX" ... Replace with <a href= "/go.php?url=http://xxxx to complete the conversion of the outer chain address. In Emlog, the change code for the reviewer URL is as follows:

After completing the go.php modification and uploading to the root directory, open the template's module.php file and find the following code in the comments list (similar to each version method, the exact location may be different):

<a href= "'. $comment [' url ']. '" target= "_blank" >

Replace it with:

<a href= "/go.php?url=". $comment [' url ']. ' target= ' _blank ' >

You can complete the redirect conversion to the Emlog Blog reviewer URL link. Further, you can also open robot.txt in the following line add the code below to reject the redirected external link being indexed by the search engine! : Disallow:/go.php?url=*

Additional Note: Open go.php, you can also set whether it is a direct jump, $directGo set to False, a framework to load the outer chain page.

The above describes the Web site to redirect the chain, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

Related articles:

Three ways to redirect PHP pages

PHP redirection vs. pseudo-static differences

Summary of two methods for JavaScript redirection URL parameters

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.