Answer the question
In order to leave comments, you need to log in
How to redirect user from all pages of one domain to page of another domain via htaccess?
It is necessary to make the server redirect from all pages of one domain to a specific page of another domain (about 200+ pages).
For example, the user visits https://test.ru or https://test.ru/page/ etc -> he is always redirected to " https://test2.ru/page3/ "
Apache hosting. Access only .htaccess
Answer the question
In order to leave comments, you need to log in
RedirectMatch 301 ^ https://test2.ru/page3/
Or
RewriteEngine on
RewriteRule ^ https://test2.ru/page3/ [R=301,L]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(?:www\.)?test\.ru$
RewriteRule ^ https://test2.ru/page3/ [R=301,L]
.htaccess
- This is for Apache only.
To do what you want with NGINX, you will need to edit its config.
Then restart the service, or send a signal to it to reread the config files.
The simplest option in nginx:
server {
listen 80;
listen 443 ssl;
server_name domain1.ru;
ssl_certificate ...........;
ssl_certificate_key ............;
return 301 https://domain2.ru/page3/;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question