4

I have a reasonably fresh WordPress install on my Ubuntu Linux server and I uploaded an image to it for use in a blog post. I checked the path in WordPress settings and I checked the contents on the server:

$ ls -l /srv/www/wp-uploads/blog.linformatronics.nl/2013/01
total 320
-rw-rw-r-- 1 www-data www-data 22033 Jan 19 10:23 ccs5licence1-150x150.png
-rw-rw-r-- 1 www-data www-data 64195 Jan 19 10:23 ccs5licence1-300x214.png
-rw-rw-r-- 1 www-data www-data 22033 Jan 19 10:19 ccs5licence-150x150.png
-rw-rw-r-- 1 www-data www-data 71973 Jan 19 10:23 ccs5licence1.png
-rw-rw-r-- 1 www-data www-data 64195 Jan 19 10:19 ccs5licence-300x214.png
-rw-rw-r-- 1 www-data www-data 71973 Jan 19 10:19 ccs5licence.png

The files are actually uploaded through WordPress, so it has write access to the filesystem/directory.

But when I try to use it in a blog post it shows a broken image and when I point the webbrowser directly to the image it throws an error 404 page: https://blog.linformatronics.nl/wp-uploads/2013/01/ccs5licence1.png

From the settings => media page in WordPress:

Uploading Files
Store uploads in this folder /srv/www/wp-uploads/blog.linformatronics.nl    
Full URL path to files       http://blog.linformatronics.nl/wp-uploads  

I'm fairly new to WordPress, so I still need to find my way around a bit.

3
  • 1
    I never heard of a wp-uploads/2013/01/ directory structure, but wp-content\uploads\2013\01. Is everything alright? or I'm wrong? Commented Jan 19, 2013 at 9:55
  • When I upload a file using the WordPress built in media upload dialog, the files are actually put into the exact mentioned location and I copied the settings in my post. The average Linux server uses forward slashes.
    – jippie
    Commented Jan 19, 2013 at 11:10
  • Solved it by adding a symlink: sudo ln -s /srv/www/wp-uploads wp-uploads Still don't know why it doesn't work through the regular config, but apparently the rewrite rules are not in place.
    – jippie
    Commented Jun 27, 2013 at 19:52

4 Answers 4

1

I think the problem is that you are storing your images in /srv/www/wp-uploads/blog.linformatronics.nl/2013/01 but your link to the image is https://blog.linformatronics.nl/wp-uploads/2013/01/ccs5licence1.png.

What you need to do is tell wordpress to store the images in /srv/www/blog.linformatronics.nl/wp-uploads/2013/01.

What your trying to do, it seems, is store images in wp-uploads/blog.linformatronics.nl but the folders should be swapped. It's the website name and then the wp-uploads folder.

2
  • The problem is why images are being uploaded to that strange location. Can you explain why that might be happening or what to do to fix it?
    – s_ha_dum
    Commented Jan 19, 2013 at 22:52
  • 1
    As you said the settings from Setings > Media is Store uploads in this folder /srv/www/wp-uploads/blog.linformatronics.nl That needs to be /srv/www/blog.linformatronics.nl/wp-uploads/ OR /srv/www/wp-uploads/. Which one works will more depend on your server setup
    – Vincent P
    Commented Jan 20, 2013 at 9:35
1

Just ran into this problem and found that navigating to Settings > Media and then changing the Full URL path to files setting from

http://<domain>/wp-uploads

to

http://<domain>/wp-uploads/<domain>

eg http://blog.mysite.com/wp-uploads/blog.mysite.com

2
  • Still receive the 404.
    – jippie
    Commented Jun 27, 2013 at 19:34
  • Did solve it now with a symlink, see above. Your hint was part of the solution.
    – jippie
    Commented Jun 28, 2013 at 19:45
0

You are telling WordPress to store the images outside the path of your WordPress install. It is doing that but is then not able to access them.

If you specifiy a path within the WordPress install (the default is wordpress/wp-content/uploads/) WordPress will be able to find the stored images.

0

A reason for this behavior also could be, that, after moving your DB improperly, the auto increment (A_I) property is missing on your tables.

Thus, make sure you have the A_I set on the posts table (and all others) again.

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.