7

On my wordpress site all my images are showing up as broken links. They are also showing up as broken links in the media gallery in the wordpress backend.

I inspected the images using Google chrome and saw that they all show up like this:

<img src="http://firouzeh.co.uk/frouzeh/frouzeh/wp-content/uploads/sites/3/2013/04/Granulated-Persepolis-Ring-230x160.jpg">

there is a duplication of a file name in the path and to get the images to work I need the path to look like this:

<img src="http://firouzeh.co.uk/frouzeh/wp-content/uploads/sites/3/2013/04/Granulated-Persepolis-Ring-230x160.jpg">

I have searched through the database and cannot find where to change the path to my images, specifically I think there must be a field somewhere that is directing everything to www.firouzeh.co.uk/frouzeh where it should just be sending it to www.firouzeh.co.uk.

Does anyone know where to change the path?

contool
  • 1,034
  • 3
  • 18
  • 29

3 Answers3

8

If your URL settings are correct under Settings > General, then you could try using a Search and Replace plugin to update every occurrence in your database.

http://wordpress.org/plugins/search-and-replace/

Search for firouzeh.co.uk/frouzeh/frouzeh Replace it with firouzeh.co.uk/frouzeh

Back up your site first :)

If you did just move your site from another location, I suggest using the Duplicator plugin, which handles all of the replacing.

http://wordpress.org/plugins/duplicator/

Kenny
  • 142
  • 8
3

Use the same solution I wrote for here: https://stackoverflow.com/a/18023214/1946078

It is as follows:

When you move a Wordpress install, you need to also edit two fields in the database. Run this against your database in order to find the values that need to be edited:

SELECT * FROM `wp_options` WHERE option_name IN('siteurl', 'home');

If database access is not an option, another way to do this is by editing your wp-config.php file to include the following two lines:

define('WP_HOME','http://yoursite.com');
define('WP_SITEURL','http://yoursite.com');

Straight from http://codex.wordpress.org/Changing_The_Site_URL

  1. The "Home" setting is the address you want people to type in their browser to reach your WordPress blog.
  2. The "Site URL" setting is the address where your WordPress core files reside.
Community
  • 1
  • 1
  • Thanks for the reply Kimberly. I should have mentioned this in the question, I'm using WP multisite with 2 sites. I have checked the wp_options file in the database for both sites and for the one in question the 'siteurl' and 'home' settings are both https://firouzeh.co.uk/ -so as would be expected. Are there any other places in the DB to look? Also to confirm, I have checked the wp_config.php file and I'm definitely looking at the right database (I have a couple of different versions in phpmyadmin) – contool Aug 02 '13 at 23:20
2

I used the solution from this article:

UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');
UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');

After changing the Site URL and WP home in the admin panel.

Poliakoff
  • 1,592
  • 1
  • 21
  • 40
  • 1
    Very good summary of all actions that needs to be performed in case of host or IP or DNS change. – Niyojan Feb 15 '23 at 13:35