Katushai
Katushai

Reputation: 1520

Incorrect URL in Wordpress leads to broken images

I just transferred a website from their previous host to hosting with me. Obviously, I had to change some of the links that pointed to the images to make them display correctly. Unfortunately, it's a huge mess. There were some links described in the mysql database, but i got into MySQL and replaced all of those with the correct link. Originally, it linked to

http://localhost/...

I now need it to link to

http://[subdomain].[website].net/

I've gone through every line of code i could find with fgrep in linux and i can't find where it's inserting localhost. Any ideas where localhost could be stored, if not in the database (as far as i can tell) and not in the physical code? I'm assuming it's a PHP variable somewhere. I'm not sure which, but i already made sure that

<?php echo get_template_directory_uri(); ?>

was set to the correct uri. Any help would be greatly appreciated. thank you.

EDIT

I tried to replace the database information correctly from a clean copy of the database. I used the serialize php script and it didn't work. the images are still not showing up and they're still routing back to http://localhost

I'm not sure what to do about it. Any more suggestions?

Upvotes: 0

Views: 261

Answers (2)

markratledge
markratledge

Reputation: 17561

1) Check page source and see exactly where the image URLs point to. Some missing image links may be hardcoded to point to the theme folder or other locations.

2) Did you also move /wp-content/uploads?

3) Dumping the database and doing a find/replace with a text editor will break URLs that are in serialized data. You have to use a tool to correctly deserialize/re-serialize data. See interconnectit.com WordPress Serialized PHP Search Replace Tool

Upvotes: 1

Rafael
Rafael

Reputation: 2817

If you're sure that you replaced every occurrence of localhost in the database, then the most likely next culprit is the browser cache, so I recommend you to delete the cache of your browser just to be sure, as this depends on your browser search for the appropriate method, but, for example, on Internet Explorer open the Developer Tools (F12) and go to Cache->Erase cache for this domain.

Upvotes: 0

Related Questions