0

I migrated a website from one host to another, and I am having a weird issue I never encountered before. The urls to images in html are fine, but the full path to the image has a broken url, the domain outputs twice.

So here is the code generated for an image:

<img src="subdomain.domain.com/wp-content/uploads/2013/12/aleksandra.jpg" class="attachment-full wp-post-image" alt="aleksandra">

And here is the full path to the image in inspector:

http://subdomain.domain.com/subdomain.domain.com/wp-content/uploads/2013/12/aleksandra.jpg

If you need more info please do not hesitate to ask. Any help is much appreciated.

Thanks

6
  • In all cases like this happen? the urls of the images in the wp_posts.post_content field in the database. How are they? Commented Feb 6, 2014 at 2:30
  • This is probably (but not sure) due to some theme / plugin that do not use the right function to get the URL.I assume that now it takes the ABSOLUTE server path, which I can assume on your new server is a PARKED domain or ADDON, as opposed to what you had before . try to see if it happens also with internal links. also try UPDATE wp_posts SET post_content = replace(post_content, 'subdomain.domain.com/subdomain.domain.com', 'subdomain.domain.com'); and UPDATE wp_posts SET guid = replace(guid, 'http://subdomain.domain.com/subdomain.domain.com','http://subdomain.domain.com'); in Mysql to see
    – krembo99
    Commented Feb 6, 2014 at 2:48
  • in the database links are ok Commented Feb 6, 2014 at 5:27
  • i did a database search for 'subdomain.domain.com/subdomain.domain.com' and there were no results, i deactivated all the plugins Commented Feb 6, 2014 at 5:29
  • 1
    @BojanaŠekeljić that mean you maybe did not put the correct URL while migrating . ( maybe forgot the http:// or maybe left the main domain in the home url or blog url options)
    – krembo99
    Commented Feb 7, 2014 at 3:53

3 Answers 3

1

Back up your database (this is very very important) and download and install "Velvet Blues Update URLs" plugin. On the settings page enter in the old URL field http://subdomain.domain.com/subdomain.domain.com

Enter in the new URL field the URL of your website. Select all options and click "Update". Update your permalinks as well.

1

You should use a plugin like WP Migrate DB which enables you to enter the new site address and server path before exporting the database. This does a search find and replace which you may need to do now using a solution like https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

"Velvet Blues Update URLs" plugin is another solution or export your DB again.

1
  • Yeah I used WP Migrate DB, but made a mistake, didn't add http:// for new url. Thanks for the answer! Commented Feb 6, 2014 at 12:56
0

I figured out the problem, when I was exporting the database using Migrate DB plugin, I didn't put the http:// before the new domain... so all the internal links were broken.

0

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.