WordPress.org

Ready to get started?Download WordPress

Forums

Download Monitor
Moved wordpress folder to root folder... how to change download links (6 posts)

  1. Mac Man
    Member
    Posted 2 years ago #

    Hi

    I added a load of downloads to a site I'm working on. I used a sub domain to build the site on. I've now moved the site to the root directory. However... the download links have retained their original URL eg http://test.mysite.com, rather than http://www.mysite.com

    Is there a quick fix to solve this...

    Will I need to go into phpMyAdmin to solve this?

    Thanks in advance

    Chris

  2. Paul Kaiser
    Member
    Posted 2 years ago #

    Hi Chris,
    Yes, I recommend:
    a. Backup your wordpress database just in case.
    b. Use MySQL search and replace to change the URL of your downloads.
    Good luck,
    Paul

  3. petet_uk
    Member
    Posted 2 years ago #

    Yeah I usually go into phpmyadmin or something like it, but you can do most with the below SQL statement

    UPDATE wp_posts SET post_content = REPLACE(post_content, 'test.mysite.com', 'www.mysite.com') WHERE post_content LIKE '%test.mysite.com%';
    
    UPDATE wp_options SET option_value = REPLACE(option_value, 'test.mysite.com', 'www.mysite.com') WHERE option_value LIKE '%test.mysite.com%';

    Be wary with the wp_options query though, as you have any rows in wp_options with serialised arrays in there containing URLs and it changes the URLs, it will corrupt the serialised array. (cForms II is one that I've had fun with in the past).

  4. Mac Man
    Member
    Posted 2 years ago #

    Thanks... I've not done anything like this before so any detailed advice would be appreciated

    Chris

  5. Paul Kaiser
    Member
    Posted 2 years ago #

    Chris, petet's right. Just make sure to make a backup of your database first. By the time you get done, you'll have a better understanding of the WP database.

    When I have to change the domain for a site, I usually use phpmyadmin to search all tables for 'olddomain.com' -- because it will be stored in places you might not realize.

    There is a plugin, I think called Backup Buddy, that will take care of all this for you. I had to use it once for a client and it was great, but I think he had to pay for it.

  6. petet_uk
    Member
    Posted 2 years ago #

    It's just trial and error really. Once you get to know the plugins you are working with, you know which ones are affected by a go live process and what you have to do.

    Key is as Paul says, back up your database first. If you don't know how to do it through phpmyadmin, there are plenty of plugins out there but I wouldn't be able to recommend one to you as I usually do direct SQL dumps.

    Good luck.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic