Broken images even though paths are correct and files exist

Good afternoon!

My username is epiz_28595258. The website I need help with is http://skrivarverkstan.great-site.net/.

I recently uploaded my website from my local computer to the above domain via FTP. Predictably, this caused all images on the website to show up as broken due to their “src” attributes no longer containing the correct domain name. However, even after updating the src attributes (by doing a search and replace of the old domain name in the database) the images still show up as broken.

Take, for instance, the image titled “Pen and Parchment” on the front page. Its src attribute contains the correct (updated) path, the “casing” of the path and filename is correct and I have also verified that the image does in fact exist on the server. I have also checked the read/write privileges for the image directory (755 for the directory and its subdirectories, 644 for individual files) but from what I can tell nothing seems out of place here.

So I have come here for advice, with the hope that someone more experienced than myself can tell me how to proceed and hopefully get my website and its images working normally again.

Any ideas or pointers will be much appreciated.

Many thanks.

/jenny

Can you please share your .htaccess file here?
Thanks.

Read more: How to Fix the 403 Forbidden Error in

Looking at the image on the home page, it points to the URL https://skrivarverkstan.test/wp-content/uploads/2020/11/cropped-feather.png

I don’t think skrivarverkstan.test is a real domain name.

2 Likes

@Admin, can you tell me where you see this? When I copy the URL for the image it gives “http://skrivarverkstan.great-site.net/wp-content/uploads/2020/11/cropped-feather-150x150.png” which leads to the default 403 error page. All the images seem to have valid links, but lead to a 403.

Dev tools

1 Like

Ah, I can’t see that on a managed Chromebook. Thanks.

1 Like

4 posts were split to a new topic: On my localhosteverything works correctly but when I pass it to the server the images are broken

Hi @Greenreader9, thank you for helping. :slight_smile: Here is the content of my site’s htaccess file:

# BEGIN All In One WP Security
#AIOWPS_BLOCK_WP_FILE_ACCESS_START
<Files license.txt>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
<Files wp-config-sample.php>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
<Files readme.html>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
#AIOWPS_BLOCK_WP_FILE_ACCESS_END
#AIOWPS_BASIC_HTACCESS_RULES_START
<Files .htaccess>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
ServerSignature Off
LimitRequestBody 10485760
<Files wp-config.php>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
#AIOWPS_BASIC_HTACCESS_RULES_END
#AIOWPS_PINGBACK_HTACCESS_RULES_START
<Files xmlrpc.php>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
#AIOWPS_PINGBACK_HTACCESS_RULES_END
#AIOWPS_DEBUG_LOG_BLOCK_HTACCESS_RULES_START
<Files debug.log>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
#AIOWPS_DEBUG_LOG_BLOCK_HTACCESS_RULES_END
#AIOWPS_DISABLE_INDEX_VIEWS_START
Options -Indexes
#AIOWPS_DISABLE_INDEX_VIEWS_END
#AIOWPS_PREVENT_IMAGE_HOTLINKS_START
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png)$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://skrivarverkstan\.test [NC]
RewriteRule \.(gif|jpe?g?|png)$ - [F,NC,L]
</IfModule>
#AIOWPS_PREVENT_IMAGE_HOTLINKS_END
# END All In One WP Security

# BEGIN WordPress
# Direktiven (raderna) mellan ”BEGIN WordPress” och ”END WordPress” är
# dynamiskt genererade och bör endast ändras via WordPress-filter.
# Eventuella ändringar av direktiven mellan dessa markörer kommer att skrivas över.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Hi @Admin, you are right. :slight_smile: There are two images on the start page and for some reason the search and replace I performed on the database had no effect on the url of the image called “cropped-feather.png”. I’m not sure why, maybe there is some code or plugin interfering with that particular image? The vast majority of the images on the website contain the correct/updated url, though, and they still appear as broken. :woman_shrugging:

UPDATE. I tried deleting all directives added by my website’s security plugin in the .htaccess file and now most of the images on the frontend of the site are displaying normally (except the ones whose src/url I have been unable to update). Images in the backend/admin section, including those in the media library, are unfortunately still broken.

I think the easiest thing to do is export DB

and then review with some txt editor looking for the wrong PATH

you can also try directly

and then one by one in each table you go and check the content and edit as needed


or use this plugin (I did not test it)

you’re basically looking for this "skrivarverkstan.test" if it is the only wrong PATH there

5 Likes

Hi @Oxy, thanks for helping. :slight_smile: I performed a manual SQL query on the database tables wp_posts and wp_postmeta to replace the old domain name with the new one. This resolved the majority of the broken images across my site, with the exception of some media library images that still appear as broken when viewed in “list mode” but work just fine when viewed in “grid mode”. Since the grid vs list mode thing is likely a WordPress-related issue rather than a server/web host-caused problem, I have decided to turn to the WordPress developer forums for further help.

In the future I will consider using the Search and Replace plugin as suggested by yourself and others. Thank you so much to you, @Greenreader9 and everyone else who took the time out of their day to try to help me with this matter, I really appreciate it. :slight_smile:

Cheers!

/jenny

4 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.