Home > Net >  Wordpress Migration .net to .ca problems
Wordpress Migration .net to .ca problems

Time:07-06

Yesterday I migrated my Wordpress site to new hardware, and from my .net URL to .ca

After migrating the site I was able to login and everything was working correctly, but during testing I noticed that the old login page, example.net/wp-login.php still exists. The old login example.net/wp-login.php doesn’t allow a user to login, it shows the error: “An error was encountered while trying to authenticate. Please try again.”, but I still want to remove it / redirect to the new one.

I thought there was a chance I missed a URL in search and replace, or somewhere else in my config, so I started again. I purchased the plugin duplicator pro to handle the migration and I double checked all the usual suspects. wp-config, wp-login, functions.php etc etc.

After migrating the site, the problem remains.

I began to wonder if it was a DNS or Nginx conf issue. In Route53 I have both .net and .ca A records pointing to the same elastic IP (of the .ca server) then I have my conf set to redirect to example.ca like this:

# Redirect HTTP -> HTTPS
server {
    listen 80;
    server_name www.example.ca example.ca www.example.net example.net;

    return 301 https://example.ca$request_uri;
}

server {
    listen 443 ssl http2;
    server_name example.ca;
    root /var/www/html/;
    index index.php;

I have tried many different nginx conf configurations, and none of which change this issue.

Lastly, I’ve used MxToolbox to check DNS and propagation and everything is correct.

Any ideas?

AWS Linux 2, Nginx, PHP 8, MySQL 8.0.29 (Remote)

Update / Edit:

The problem is a login page exists for .net when it should only be .ca

There are no errors in the error logs.

CodePudding user response:

Thanks to John Hanley for pointing out I needed a listener for example.net.. Adding the listener fixed the problem. My new config now looks like this:

# Redirect HTTP -> HTTPS
server {
    listen 80;
    server_name www.example.ca example.ca www.example.net example.net;

    return 301 https://example.ca$request_uri;
}

server {
    listen 443 ssl http2;
    server_name example.net;
    return 301 https://example.ca$request_uri;
# SSL parameters
    ssl_certificate /etc/nginx/ssl/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/privkey.pem;
    ssl_trusted_certificate /etc/nginx/ssl/chain.pem;
}

server {
    listen 443 ssl http2;
    server_name example.ca;
    root /var/www/html/;
    index index.php;

#The rest of my config
  • Related