We are changing our company website, old wordpress website is on old server centos/apache with ip 10.10.10.20 and the new one has different ip 10.10.10.200. The deal was to just edit dns entries, as the new website should have the same domain. The old ip was removed from dns and the url was https://www.example.com.
The new website on https://example.com works perfectly, but the https://www.example.com or www.example.com show error: This site can’t be reached
/etc/httpd/conf.d/site.conf
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/example.crt
SSLCertificateKeyFile /etc/pki/tls/private/example.key
SSLCertificateChainFile /etc/pki/tls/certs/DigiCertCA.crt
DocumentRoot /var/www/html
ServerName example.com
ServerAlias www.example.com
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
Redirect "/" "https://example.com/"
ErrorLog /etc/httpd/logs/error_log
CustomLog /etc/httpd/logs/access_log combined
</VirtualHost>
.htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
# BEGIN Redirects
RewriteEngine On
# 301 redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# 301 redirect to https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# END Redirects
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The developer installed the plugin for redirection and the dns has entries like: example.com 10.10.10.200 and alias www.example.com
$curl -I www.example.com returns:
HTTP/1.1 302 Found
Date: Thu, 24 Feb 2022 19:21:01 GMT
Server: Apache/2.4.37 (centos) OpenSSL/1.1.1k
Location: https://example.com/
Content-Type: text/html; charset=iso-8859-1
I just want www pages to redirect to https://example.com , could it be that google/crawler remembered our old ip address and always tries old dns entry? Should I wait a few days ? It's been more than 48h. Can this be fixed somehow?
Thank you!