How To Redirect From Site To Site

Table of contents:

How To Redirect From Site To Site
How To Redirect From Site To Site

Video: How To Redirect From Site To Site

Video: How To Redirect From Site To Site
Video: How to redirect website to another website or domain 2024, April
Anonim

Domain is the soul of the site. A well-chosen domain is one of the factors in the success of a resource. Therefore, sometimes Internet projects change their address, moving to a new domain. But users still visit the old address. And sometimes the number of such visits is very significant. Losing the audience of the resource when changing the address would be just stupid. And in this case, there is nothing left to do but to redirect from site to site.

How to redirect from site to site
How to redirect from site to site

It is necessary

A site powered by an Apache server. Server configuration to allow custom.htaccess files. Active module mod_rewrite. FTP client program. Data for accessing the server via FTP

Instructions

Step 1

Connect to the site server using an FTP client program. This must be the server hosting the site from which the redirection will be performed. FTP access data is usually published on the hosting company's website or in the hosting control panel.

Step 2

Download the.htaccess file from the site root to your hard drive. If the.htaccess file is not visible in the root directory, check the status of the hidden files display mode on the server. If the mode is disabled, enable it and update the FTP listing. If you still can't see the file, just create an empty file called.htaccess on your hard drive.

Step 3

Open the.htaccess file located on your hard drive in a text editor. It must be a plain text editor, that is, text without formatting. It must be able to save the file in a single-byte encoding compatible with latin-1 encoding.

Step 4

Edit your.htaccess file. If you need to redirect all users from any url inside the site to one url of another site, enter the following lines at the beginning of the.htaccess file: RewriteEngine on

RewriteRule ^ [L, R = 301] Here, instead of the label, you need to write the address to which the redirection will take place. For example, it might look like this: RewriteEngine on

RewriteRule ^ https://codeguru.ru/ [L, R = 301] If you need to redirect from multiple site urls to similar urls of another site (for example, when changing the site's domain), then add the following lines to the beginning of the.htaccess file: RewriteEngine o

RewriteRule ^ https://% {REQUEST_URI} [L, R = 301] For example, it might look like this: RewriteEngine on

RewriteRule ^ https://codeguru.ru% {REQUEST_URI} [L, R = 301] Save the.htaccess file.

Step 5

Upload the.htaccess file to your site root directory. Use an FTP client program. If the.htaccess file already exists in this directory, overwrite it.

Step 6

Check how forwarding works. Open in the browser any address of the site from which the redirection should be made. If everything works fine, the browser will automatically load a page from another site.

Recommended: