Redirect and redirect websites to external links

Source: Internet
Author: User

Redirect and redirect websites to external links

In the comments function of Emlog, message recipients can enter their own website addresses. However, in many cases, we do not want our website to have too many messy external links. Of course, we can add the nofollow attribute to the link. That is, the original link code is

<A href = "http://www.100sucai.com"> All The Way </a>

When we add the rel = "nofollow" attribute to this link, we will tell the search engine that the link address should not pass the weight. Shape:

<A href = "http://www.100sucai.com" rel = "nofollow"> All The Way </a>

Here, we will share with you that the external link address is redirected. That is, if the external link address is a http://www.100sucai.com, through redirection, it becomes http: // your site address/go. php? Url = http://www.100sucai.com is still accessing the http://www.100sucai.com of the target website

First downloadGo. Zip fileDecompress the go. php file and upload it to the root directory of your website. Then replace the http://www.100sucai.com in go. php with your website address. Finally, you only need to change the link address from <a href = "http: // XXXX "... replace with <a href = "/go. php? Url = http: // XXXX. Now, the external link address can be converted. In Emlog, the code for modifying the reviewer's website is as follows:

After modifying and uploading go. php to the root directory, open the module. php file of the template and find the following code in the comment list (the methods for each version are similar, and the location may be different ):

<A href = "'. $ comment ['url'].'" target = "_ blank">

Replace it:

<A href = "/go. php? Url = '. $ comment ['url'].' "target =" _ blank ">

You can complete the redirection and conversion of the Emlog blog comments URL. In one step, you can also open robot.txt and add the following code to the project to reject the redirection of external links being indexed by the search engine! : Disallow:/go. php? Url = *

Note: When go. php is enabled, you can also set whether to directly jump. If $ directGo is set to false, an external link webpage is loaded using a framework.

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.