0

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.

  • URLs are often stored in the WordPress database. Start with the **wp_options** table. – John Hanley Jul 04 '22 at 18:41
  • John, I have, and they were all replaced. – JackJohnstone53 Jul 04 '22 at 18:51
  • Did you search the entire database? Your question does not include the details necessary. I can only guess at a solution. – John Hanley Jul 04 '22 at 19:01
  • John. The first time I manually searched and replaced. The second time I used Duplicator Pro, which handles the search and replace automatically. I have since performed additional searches and cannot find my old url in the database anywhere. – JackJohnstone53 Jul 04 '22 at 19:09
  • Then search the PHP code and configuration files. – John Hanley Jul 04 '22 at 19:10
  • John, I have. I can only find the old URL in the Author URI of a few custom plugins I’ve built, and within the Nginx conf file I shared in the post. I think it has to do with the Nginx redirect. – JackJohnstone53 Jul 04 '22 at 19:38
  • You have a listener configured for port 443, host example.ca. You do not have a listener configured for example.net. That means you cannot receive requests on https://example.net. Edit your question with actual details on what the problem is including detailed request and error messages/responses. – John Hanley Jul 04 '22 at 19:41

1 Answers1

0

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