How to make a link redirect

How to make a link redirect

The essence of a redirect comes down to the fact that transition to external reference is made through the script located in the website. As a result the user passes to an external resource, and the search robot in the course of indexation remains in the website. The script of a redirect can be written differently. The given example it is necessary to review as acting, but not only correct.

It is required to you

  • Access to the file system of the website, the simplest text editor, for example, "Notepad".

Instruction

1. On the local computer open "Notepad" and write a script in the PHP language of the following contents. $urlsite = $ _GET ['urlsite']; if (! empty ($urlsite)) {$urlsite = str_replace (""http://"", "", $urlsite); $urlsite = ""http://"". $urlsite; header (""location: $urlsite""); } This script receives the urlsite parameter by means of the GET method and checks whether it is empty. Further deletes from it http:// if it is, leaving only the part of URL which is not containing like the protocol. Then again pastes http://. Thus the possibility of duplication of the pointer of the protocol necessary for the correct readdressing is excluded. The last line the script specifies to the browser the address for connection.

2. Save the created file under the name of redir.php. In the menu of "Notepad" select "File", further "Save as". Specify "all types" in the section of a file type of a window of saving, and write a file name completely with expansion.

3. Load the created file of a script into the root directory of your website via the control panel. Find the File manager menu, come into the folder of the website and click "Load". Find a script on the computer and click "Begin to rock". The redir.php file will appear in the root directory of the website.

4. State the ban on indexation for search robots in the robot.txt file: user-agent: * Disallow:/redir.phprobot the searcher will be ignored by this script.

5. Add the reference of a view http://ваш-сайт.ru/redir.php?urlsite=http://куда-нужно-поставить-ссылку.ru/ in the right place of the website. If necessary to transfer to the address the sign "\to U-0026\", replace it with "%26", a space on "%20", "@" on "%40". Now the link is internal, but through a script conducts on an external resource. The search robot will ignore it and to continue indexation of the website. So-called "web page rankings", tITs and PR, will not be transferred.

Author: «MirrorInfo» Dream Team


Print