B
B
Breeze12019-04-23 20:51:48
htaccess
Breeze1, 2019-04-23 20:51:48

Change domain to Wordpress?

I want to change the domain on my wordpress site. The hosting stays the same, the domain just changes.
What was done. Bought a new domain, installed https. All links in the database have been replaced with the new domain.
On the hosting, the old and new domains are now linked to the site. When you try to access the site through the old domain https://oldsite , there is a redirect to the new domain. But, if you go for example https://oldsite/blog , then it is the old domain that opens. What am I doing wrong?
In htaccess
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} https://oldsite.com.ua
RewriteRule (.*) https://newsite.com.ua/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteEngine On

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Syomka Gavrilenko, 2019-04-24
@Breeze1

On the old domain, write in the htacess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} olddomain.ua
RewriteRule (.*) https://newdomain.ua/$1 [R=301,L]

P
Puma Thailand, 2019-04-24
@opium

You have a host specified with a protocol, but hosts do not have a protocol, remove the protocol in the host definition

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question