1

I have a WordPress site with LAMP. Since I moved to a new apartment the site does not display well anymore, and I cannot access its dashboard through http://my-wp-site.com/wp-admin.

Note 1: I set up my Apache server to host two websites, my personal one (the primary site, which does not use wordpress) and the WordPress site that’s the object of this question.

Note 2: have bought separate domains for each site. In the old place I had a fixed public IP, so both domains pointed to that IP, which would then resolve to either the primary site or WP site according to their respective ServerName. After I moved to the new place I had to set up a Dynamic DNS service. Now both domains points to that service’s url (http://mydnsdomain.ddns.com). Users can still access the website through each site domain address, which remained http://my-primary-site.com and http://my-wp-site.com. Since I changed the access point from my the old fixed public IP to the dynamic dns address, I understand this is a case of migrating the WordPress site.

Note 3: I have backed up my website through UpdadraftPlus and am trying to restore from that backup.

WHAT I DID

  1. I followed this guide to do a clean install of wordpress.
  2. I then created a news MySQL database for the new installation.
  3. Once the set up was done, I installed the UpdadraftPlus plug-in, and uploaded the backup files. I restored each component one by one: uploads, themes, plugins, others and database. All but the last one work fine.
  4. When I try to restore the database I get this warning message:

"The website address in the backup set (http://my-wp-site.com) is slightly different from that of the site now (http://www.my-wp-site.com). This is not expected to be a problem for restoring the site, as long as visits to the former address still reach the site"

I ignored the warning because both those addresses point to the ddns, which I thought would re-route the request to the new address, as it did before restoring the database.

After restoring the database, I get another warning saying that "The database table needs to be repaired". I follow the instructions and go through the repair process – according to which everything went fine.

However, once that is done the website (http://my-wp-site.com) looks messed up, and the admin dashboard (http://my-wp-site.com/wp-admin) is not accessible: "Not Found. The requested URL was not found on this server."

I wondered if this was due to the dynamic DNS interfering, but before I restored the database everything worked.

This article suggests to use the better search replace plug-in to solve the problem, but I cannot access my dashboard.

I thought about two options:

  1. Avoid creating a new database during the installation and set the website to the same DB_NAME, DB_USER, DB_PASSWORD and DB_HOST as before. (Sounds risky.)
  2. Do the better search replace procedure before restoring the database.

Any other ideas?

2
  • I'd guess it's the Apache VirtualHost config. Is the www version definitely configured as a virtual host?
    – Rup
    Commented Jan 5, 2020 at 17:30
  • This is how the /etc/apache2/sites-available/my-wp-site.conf file is set: ServerName mydnsdomain.ddns.com | ServerAlias www.my-wp-site.com | ServerAlias my-wp-site.com. (the "|" symbol represents a line break, and is not present in the file) Is that what you meant?
    – Fede9390
    Commented Jan 5, 2020 at 18:23

1 Answer 1

0

I was able to solve the problem by adding these two lines to /var/www/my-wp-site.com/public_html/wp-config.php:

define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
1
  • OK, so you just had the two URLs configured wrong in settings, general? Glad you got it working, but I'm not sure that explains the admin site not working.
    – Rup
    Commented Jan 6, 2020 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.