• Hello,

    My website database was damaged by a freelancer I hired and we were not able to fix it.

    So I did the followings to get my site back online as quick as possible :

    1. In my hosting account (BlueHost), I unassigned my domain name (an addon domain) to its current directory. At this point the site is not even on the internet at all.

    2. I assigned my domain to a new directory in my hosting account. Both directories (the old and the new) are at the same level, directly in the root of my hosting account.

    3. I installed a new wordpress site on the domain. Meaning I’m now using a new database.

    4. I uploaded my site backups that I had created with the plugin “UpdraftPlus Backup and Restoration” BEFORE any damaged were done to the site and restored it. Note: the backup included everything (database, images, plugins, themes, etc).

    It works almost perfectly.

    The only issues I have is that some plugins seem to still be getting stuff from the old directory and this is causing issues with images. For example I’m unable to upload new pictures on my site now.

    Why is this happening? Any idea what additionnal steps I need to take?

    Thanks in advance for your help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • 2. I assigned my domain to a new directory…
    4. I uploaded my site backups…[including old] (database…)

    …some plugins seem to still be getting stuff from the old directory…

    Why is this happening?

    Because the old database still thinks the old directory is still in use, and this should resolve that:

    note: Edit ‘pref’ (three places below) to your own table_prefix and change ‘https://www.olddomain.com’ and ‘https://www.newdomain.com’ as required (three places each and with no trailing slashes)

    UPDATE pref_options SET option_value = replace(option_value, 'https://www.olddomain.com', 'https://www.newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE pref_posts SET guid = replace(guid, 'https://www.olddomain.com', 'https://www.newdomain.com');
    UPDATE pref_posts SET post_content = replace(post_content, 'https://www.olddomain.com', 'https://www.newdomain.com');

    Thread Starter palevesque

    (@palevesque)

    Hi, thanks for your reply.

    Okay, but ‘https://www.olddomain.com’ and ‘https://www.newdomain.com’ are the same in my case. I did not change the domain. All URLs have remained the same.

    What changed is the directory where the domain is pointing in my hosting account.

    The domain was previously assigned to this directory in my hosting account : /public_html/palevesque

    and now is assigned to this one instead :
    /public_html/palevesque3

    Is there a reference to this somewhere in the wordpress database?

    You did not change the domain, but you did change the location where it is to land:

    old WordPress location: ~~~/palevesque
    new WordPress location: ~~~/palevesque3

    Whatever you previously had in the boxes at Settings > General still exists in some places in the database even though what you presently have in the boxes shows as since updated.

    CPanel controls how and where your domain is assigned, then the boxes tell the database what to actually expect coming in and what to use to tell WordPress how to find things (uploads, etc.). Sometimes I have changed what is in the boxes and not had to do more, but sometimes I have had to use the code I had posted…and maybe someone who knows more than I can explain why!

    edit: Caution. Changing palevesque to palevesque3 might possibly also result in instances of palevesque3 being changed to palevesque33. So, do some careful before-and-after searches there to be sure about what you have at the end.

    Thread Starter palevesque

    (@palevesque)

    I never really understood what the 2 boxes in Settings – General were for.

    This is how it currently looks:
    https://palevesque.com/images/wordpress-url-settings.png

    I didn’t change those values after restoring the backup, should I? What should they be?

    After seeing that screenshot, I am cautious about making any further suggestion here without first knowing and/or figuring out more detail. At my own BlueHost account, a Primary Domain can only be assigned to public_html. So, and unless palevesque.com is an Add-On Domain, I do not know how it could be getting either to /public_html/palevesque/ or to /public_html/palevesque3/ at all unless you are using .htaccess to redirect it (as I do my own Primary Domain).

    I must have either missed or overlooked your initial mention of BlueHost, so now I would say I have understood you to say this:

    old WordPress location: /public_html/palevesque/
    new WordPress location: /public_html/palevesque3/

    You could cPanel-re-assign an Add-On in that way without changing anything, but an htaccess-redirected Primary Domain would need an edit or two in htaccess to make that work.

    Overall, and after clarifying the matter of Primary or Add-On and how assignment or redirection is actually being handled, I would suggest you go to cPanel > phpMyAdmin and search all tables for palevesque.com to see how many variations of something like ‘https://palevesque.com/whatever’ either might or might not actually appear there…and then, if necessary, and as subject to the above, possibly use the SQL code I had posted to make any corrections necessary so you can be certain your database knows exactly what to expect coming in and what to tell WordPress to use for finding things.

    edit: I just re-read with my one eye that can read and I now see you are dealing with an Add-On! So, I would just do the search I have mentioned and see what you might actually find in your database and then see what to do from there.

    Also, it is at least possible you might have a plugin or theme using “absolute server path” and will need to be uninstalled and then re-installed in order to make its own adjustment to the new location.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problem when assigning WP site to a new directory in my hosting account’ is closed to new replies.