How To Redirect To Another Site

Table of contents:

How To Redirect To Another Site
How To Redirect To Another Site

Video: How To Redirect To Another Site

Video: How To Redirect To Another Site
Video: How to redirect website to another website or domain 2024, November
Anonim

To redirect the visitor to another Internet resource, you can use the built-in capabilities of the Arache web server. When requesting pages of your site, the server software first looks in the folder of these pages for a service file named ".htaccess". If it exists, the server will follow the directives written to it. You can put in this file and redirect commands both within the same site, and to any external address.

How to redirect to another site
How to redirect to another site

Instructions

Step 1

If you need to redirect absolutely all visitors requesting any page on your site, then in htaccess you should use the following entry: Redirect / of another site.

Step 2

You can only send to another site those who request pages from a specific folder on your site. For example, for a folder named goOut, you need to change the directive above to look like this: Redirect goOut /

Step 3

It is possible to send to another site only those visitors who request documents of a certain type. To do this, you need to use another directive - RedirectMatch. It differs from the Redirect directive in that it uses a regular expression (regexp) to compare the request and the conditions written in htaccess. For example: RedirectMatch (. *). Html $

Step 4

To put this redirection method into practice, open a simple text editor (Notepad) and create a blank document in it. Draw up the necessary condition based on the given rules and write it down in this document. Then save as ".htaccess" and upload to your site's root directory. This completes the procedure.

Recommended: