• 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

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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

    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).

    Thread Starter Mac Man

    (@mac-man)

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

    Chris

    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.

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Moved wordpress folder to root folder… how to change download links’ is closed to new replies.