Folder permissions for custom Wordpress uploads folder - wordpress

I have created a new Wordpress website on my server and done everything as I normally would (nothing fancy or custom, just upload theme, a couple of plugins etc.) except I wanted a custom file path to my media folder.
I have created the folder '/public_html/i', updated my .htaccess file, updated the Setting > Media section in Wordpress with the file path and all is working fine.
My issue is that I do not want the uploads folder to be visible by navigating to the URL (www.site.com/i/).
If I change the folder permissions to execute only for group / world (711) the images become unavailable / unviewable and although I can still upload they show as broken images.
If I set to execute and read (755) the images and uploads work fine but the folder can be viewed by typing in the URL.
What are the correct permissions I should be using for a custom uploads folder to make images on the site viewable but the containing folder itself not?
Note that this is a site that will regularly have new images uploaded to it, so I would also need to be able to upload without having to change the permissions each time, which is one solution I have found online.
Thanks in advance for any help.

Add the following to your .htaccess file with the WordPress .htaccess instructions:
Options -Indexes

Related

Wordpress images does not exist in upload folder but is showing in media library

I have found a very strange problem on my wordpress/woocommerce site.
I made a copy with the plugin Duplicator, to make some changes in a localhost environment.
My uploads folder is too big, so I unset it to be copied by Duplicator. To get all the images I simply copied all files and subfolders in /uploads folder to my localhost /uploads folder. After that wordpress finds only few images. The rest doesn't exist.
To make sure I haven't missed something during the copy process, I checked the /uploads folder on my live site. And there the same image files doesn't exist. Even if the path in the media library says they are in the /uploads folder.
So the big question is, where are the images they doesn't exist in the /uploads folder?
Is wordpress capable to store images in the database?
Media files exist in upload folder but not showing up solution
Simply Paste this code in wpconfig.php and save it all is done :)
define( 'UPLOADS', 'wp-content/'.'uploads' );

Wordpress cant upload to wp-content/upload

So a client asked to make some changes to his wordpress site, I can install and run plugins, but when I try to put some images or pdf files into the media it gives me the following error: "cant upload to wp-content/upload". I have created an admin user but cant upload any media.
Check if your "uploads" folder has the right permissions.
It should be at least 755.
Uploads folder is located at /wp-content/uploads

Can't Upload Images or Plugins via Wordpress Admin

I have a website that I just transferred from one server to another. I did this by copying all the files via FTP from the old server to my computer and then to the new server. I changed the URL in Settings to the new url and I downloaded a copy of the database. I then uploaded the database to the new server and changed all the database info in the wp-config file. Afterwards I used Velvet Blues Update URLs to make sure all the URLs have been changed in the database.
After doing all the the website is working fine. I could update my plugins and my WordPress core files that needed updated.
The problem is now I can't upload a plugin from my computer or any media files like images. When uploading an image, I get this message:
“image.jpg” has failed to upload.
Unable to create directory uploads/2017/03. Is its parent directory writable by the server?
I checked and this directory is already on the server. In FTP I changed the folder permissions to all be set to 775.
I then tried to change the folder structure for media files to not be broken into month/date folders and I get this message:
“image.jpg” has failed to upload.
Unable to create directory uploads. Is its parent directory writable by the server?
I know this directory exists and is set to 775. To double check I also change the wp-content directory to the same permissions.
What am I doing wrong here? Why can't I upload images and plugins via the WordPress backend?
I actually think I figured this out. I went into Settings -> Media and noticed there was a box that says Store Uploads to This Folder and had a folder for the old website. I deleted the information that was in that box and updated the settings and now it works!
I had this exact issue today. After much troubleshooting, I solved this images not uploading issue -- specifically, when I clicked the upload button, no dialog window appeared. As a new WordPress installation, the dashboard was displaying asking if this was going to be a business or personal site. When I clicked I DON'T NEED ANY HELP, then I saw the normal dashboard with WooCommerce module displayed and I was able to upload media files and images from my hard drive.
I'm posting in case this answer can help someone else having this very weird problem. Also, it is possible that a plugin like OpinMonster might be what generated that "business or personal" message.

How to change download url path in wordpress to www.yoursite.com/download?

I am trying to hide or shorten the link to files or picture uploaded to the wp-content/uploads folder.
By default in WordPress if you upload and image, pdf, etc and insert it into a post or page it will have a link like this:
mysite.com/wp-content/uploads/2014/08/picture.jpg"
I want to hide the reference to all WP folders on my site. I am trying to find a way that the URL will display like this instead.
mysite.org/uploads/2014/08/picture.jpg"
or
mysite.org/uploads/picture.jpg"
or
mysite.org/picture.jpg"
Is there a plugin or some hack that will let me hide the "wp-content" from showing up in my urls?
Add this to your wp-config.php file for your website.
define( 'UPLOADS', 'downloads' );
Then using FTP or RDP (or however you access your server), create a folder called "downloads" in the root directory of the WordPress site.
Then you need to uncheck the box for the "Organize my uploads into month- and year-based folders" option in Settings > Media of the WordPress admin.
Note: If you already have files in the media library, those will need to be moved over and all references to the old uploads folder in the database changed, if you want it all to be consistent.

How to configure a WordPress blog to save uploaded images to a certain dir.?

I have a WordPress blog installed on my server but when i upload a image it goes into one directory, but the blog front end is looking for the images in another directory, so the images show as broken. I have been manually copying the uploaded images from server location to the one WP looks for them in and it works.
How can i set the WP blog to upload to the same dir on the filesystem that the WP front end is trying to pull from?
The problem is most likely WordPress failing to correctly guess the upload path and URL.
Go to Settings > Miscellaneous and hardcode the correct path and full URL.

Resources