How to direct traffic

How to direct traffic

Digital Hits: 91

It is the simplest to use possibilities of the Apache Web server for redirection of traffic, to be exact by means of the htaccess file to use decentralized control by all settings. It is possible to place directives in this file if to execute them, then the software will redirect users to the web addresses specified in the file.

Instruction

1. For a start open the normal text editor, for example, "Notepad". There will quite be enough opportunities it to create the htaccess file and to fill it with necessary contents. It contains directives in the form of lines of the plain text which can be edited just as files with permissions of HTML, txt, js and others.

2. Formulate commands for redirection of traffic which conform to your requirements. If you need to send each user from any of pages of your website to the same address, then place in the htaccess file approximately such line: Redirect/http://site.ru.

3. In this record the directive Redirect is a redirection command. The slash (virgule) designates a root directory of a resource here (action of the directive extends to requests of the necessary documents in all files of the website). Any request of folders of your resource will start redirection process. But if to place the similar file with other directives in some enclosed folder, then commands it will become priority for Apache. And http://site.ru specifies here the address to which the software of the server redirects traffic.

4. Instead of a root directory you can specify some folder of a resource. Then the rule of the rediket will concern users who request documents from all enclosed folders and the specified directory. For example: Redirect badBoys/http://site.ru. Also there is a possibility of redirection to the necessary address only of those surfers whose browsers send requests for files of some certain type. This mechanism is implemented by means of the directive RedirectMatch which uses a regular expression for comparison of the arrived request from the browser: RedirectMatch (. *). php$ http://site.ru. Save the made directive in the file under the name .htaccess, then load into a root folder of the resource.

Author: «MirrorInfo» Dream Team

Print