K
K
Konstantin2021-12-07 11:17:18
htaccess
Konstantin, 2021-12-07 11:17:18

How to make a 301 redirect from domain to domain, for all pages?

How to make a 301 redirect from one domain to another and not to do a redirect for each page, but to register once and the pages will also be redirected?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2021-12-07
@gradk

Add the following lines to the .htaccess file located in the folder of the site you want to redirect from:
RewriteEngine On
RewriteCond %{HTTP_HOST} old-site.ru
RewriteRule (.*) new-site.ru/$1 [R=301, L]
Where:
old-site.ru is the domain from which the redirect occurs;
new-site.ru is the domain to which the redirect occurs.

P
Puma Thailand, 2021-12-07
@opium

It's been listed about a million times on Google.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question