• Resolved suvie

    (@suvie)


    I was following instructions on this page:
    https://www.wpbeginner.com/beginners-guide/how-to-edit-wp-config-php-file-in-wordpress/

    I wanted to move the whole website from a subdomain to the root, so from shop.mydomain.com to mydomain.com.

    I downloaded all files from the subdomain onto my computer, then uploaded them onto the root directory and changed the site and home url’s in the wp-config file.

    I could log into wp-admin, but now all the content for the site is missing, such as the multiple plugins and my themes. I tried to do the next step in this blog where you download the “Velvet Blues Update URLs” plugin, but the second it started download it failed – I assume it is because it cannot access the folder for the plugins.

    What can I do to fix this? I saw one example where you also defined the content url in the wp-config file, but I could not get that to work. One of these attempts was:

    define(‘WP_CONTENT_DIR’, ‘/wp-content’);
    define(‘WP_CONTENT_URL’, ‘https://mydomain.com/wp-content’);

    Has anyone had this same issue?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • abletec

    (@abletec)

    Hello, suvie, & welcome.

    Likely the best way to do this is w/a database search-&-replace. Right now I rather suspect your urls look like:
    https://thecontrastclub.com/shop/wp-content
    & they need to be changed to:
    https://thecontrastclub.com/wp-content
    Obviously those url’s are just examples, & you would need to fill in the actual ones. The script I tend to use for this purpose is search-&-replace-db by InterconnectIt, but there are others. It goes w/o saying, except it doesn’t, that you should take a backup of your database prior to doing any sort of search-&-replace, as these sorts of scripts don’t have an undo function. Were I you, I’d make 2 backups, just to be extra sure.

    Please also look to your index.php file & ensure that the last line points to the root of your site now. So it should be ‘thecontrastclub.com’ as opposed to containing any other subdirectories.

    abletec

    (@abletec)

    suvie, I had a closer look at your site. 1 thing I’m seeing is that it appears you’ve got a lot of mixed content, ie, http & https addresses together. That will need to be addressed.

    It appears that at least some of your url’s are ok, ie, pointing to the wp-content off the root, but do please check your index.php file to insure that it, too, points to the root.

    Some of your widget urls are not right, ie, https://shop.thecontrastclub.com/index.php/my-account/”>MY ACCOUNT, so those do need to be changed as I suggested above. Please also ensure that you have a .htaccess file in your root folder & that the base refers to /.

    HTH. Don’t hesitate to post your index.php or .htaccess file if you need assistance w/all that. Please ensure that if at some point you decide to post your wp-config.php, all user credentials are removed.

    Thread Starter suvie

    (@suvie)

    Hello abletec,

    Thanks so much for your help! So the index.php file currently only has this:

    <?php
    /**
     * Front to the WordPress application. This file doesn't do anything, but loads
     * wp-blog-header.php which does and tells WordPress to load the theme.
     *
     * @package WordPress
     */
    
    /**
     * Tells WordPress to load the WordPress theme and output it.
     *
     * @var bool
     */
    define( 'WP_USE_THEMES', true );
    
    /** Loads the WordPress Environment and Template */
    require __DIR__ . '/wp-blog-header.php';

    I tried changing that to
    require __DIR__ . ‘https://thecontrastclub.com&#8217;;
    but that just kills the whole external site. Admin is still fine.

    The htaccess file is in the root as it should (i.e. the /www/ folder) and I think the base is correct, this is the end of the file:

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    I know the url’s are a bit of a mess, I have not had a chance to change them yet, and now I can’t really access anything. For example the account page is part of Woocommerce and I can’t see the plugins or extensions at all on the admin side, it is like it’s just a skeleton of the real site.

    Do you think I need to do the replacement in the DB then? That does sounds like an awful end result of this “easy move” :’D I did take a backup already of the site before starting any of this luckily.

    abletec

    (@abletec)

    @suvie, your .htaccess & index.php files look ok, please revert your index.php changes back to what they were when you posted this. The last line of that file requires a directory, not a url.

    Were I you, I’d also change the home & site url’s in the database, so you could actually do a search like:
    search: shop.thecontrastclub.com
    replace: thecontrastclub.com

    Once that’s done, you can get rid of them in the wp-config.php file, which I would recommend.

    1 thing I’d say to you–you can *never* have too many backups. Well, maybe you can, always label them w/a date so you know which 1 is which, & make sure you back up your database. Do you know how to do that? I’m not trying to be condescending, I’m just trying to make sure everything is in order. Woopsies are not good when dealing w/this sort of thing. They’re particularly perilous when using email to conduct sensitive support tasks. I need to ensure we can exit gracefully if required.

    I got an error when I tried this at my blog Naijatechclan

    Thread Starter suvie

    (@suvie)

    Okay so I have replaced all of the old subdomain with the new, but it did not help, in fact it made it worse.

    I think I will have to undo all changes. Luckily I can restore the db and I have not deleted files from the old domain yet, so that might be easier to reverse. Will see.

    I guess I will just have to try this later in a different way.

    Obviously if you have any good suggestions, please do let me know.

    abletec

    (@abletec)

    Actually, @suvie, it looks *so* much better than it did yesterday when I initially looked at it. Please try clearing your browser cache & see if that doesn’t help you.

    Thread Starter suvie

    (@suvie)

    I actually got some friends of friends to look at it and I don’t know what they did but it’s now back to normal.

    Shame though, as normally you would like to be able to post a solution here so that others could follow it if they ended up in the same mess :/

    • This reply was modified 4 years ago by suvie.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Wp-content missing after moving from subdomain to root’ is closed to new replies.