It is enough to say ChatGPT and already most will know that it is something...
When it comes to site content, especially when it comes to content like slika, The way they are managed can be of great influence on SEO and in general on the overall performance of the site. The answer to the question of how to change Media library upload folder it can certainly be of great help.
WordPress By default, it saves all media files such as images, videos, and PDFs in a folder called "Upload“. You can see the image uploaded from your site using the following path: https://www.nazivsajta.com/wp-content/uploads/naziv-fajla-slike.jpg
If for any reason you want to change the default folder (in this case the folder Uploads) to any other folder that suits you best, here's a step-by-step guide on how to change it Media library upload folder.
How to change Media library upload folder?
There are two ways to change the Media library upload folder to upload images and other media:
- Creating a new folder in WordPress installation on cPanel
- Create a new folder on a subdomain outside of your own WordPress installations
In our text we will stick to the first way.
Create a separate folder within the WordPress installation
This will also help you in extra security by moving all your media files out / wp-content folders. These are the steps involved in this process:
- Create a new upload folder
- Change wp-config.php files
- Move existing media files to a new folder
- Checking and repairing broken links
- Uploading a new media file and checking its permission
Za novi WordPress site only the first two steps are required, and all other steps are required for an existing site that has media content files.
Creating a new folder
Assuming you want to place all your media files in a new directory called for example "Pictures", you must first create a folder with that name in root-u your WordPress installations. You can also create a folder with FTPor using the "File Manager“Which is available inside cPanel your hosting account.
Log in to your hosting account and open the "File Manager which is available on the path Hosting> cPanel> File Management> File Manager.
Please select root the directory where your WordPress is installed.
Please select "Web Root (public_html / www)“If you have installed WordPress u root directory or select a subdirectory from the drop-down menu "Document Root for“If you have installed WordPress on a subdomain or subdirectory of the main domain.
By selecting an option New Folder a window opens in which we create and name a new folder in which we want to store media content, in our case images. After determining the name of the new folder and checking if the path on which it will be saved is good, click on Create New Folder.
Now within the WP installation we can see the newly created folder, in our case named Pictures.
Modify the “wp-config.php” file
The next step is change wp-config.php file located in your root directory (usually / public_html). Click on the icon Edit u File Manager-u.
Add the following lines of code to the file wp-config.php and save changes.
define ('UPLOADS', ”.'Pictures');
Be sure to note that the quotes are written correctly (as in the example above), otherwise the changes will not be applied correctly.
Move existing files to a new folder
When you change the upload folder to wp-config.php all existing media (images) from the site will automatically change the URL to https://www.nazivsajta.com/Pictures/naziv-fajla-slike.jpg. This will result in a malfunction (broken) links to posts and site pages. You must move all existing files to the new Picures folder to customize broken links. You can do this along the way File Manager-and by dragging and dropping all image files from the old folder to the new one.
The final step is to check if it still exists broken (discontinued) links on the site. One way is to take advantage of some of the many tools available on the internet.
From now on every new file upload-the ram on the site will be saved in the new "Pictures" folder.
At the end upload-Check the new image and check that the file path is saved in the newly created "Pictures" folder. If you see that the image is not found or a 403 error is reported, the most likely reason may be the file settings of the newly created folder. To check permissions, connect your FTP software to the server and go to the new folder Pictures. Right-click and select an option File Permissions. Select the appropriate permission settings and the numeric value should be 755.
We hope our text explained to you how to change the Media library upload folder. Don't worry, after years of experience, all this will be your cat's cough. And until then read more educational texts on our blog.
Made by Nebojsa Radovanovic - SEO Expert @Digitizer