Skip to content

Where does WordPress store site images?

WordPress is an extremely popular CMS (content management system) platform that allows users to create and manage their own websites. One of the most frequently asked questions by new WordPress users is “Where does WordPress store site images?” The answer to this question is simple: WordPress stores all media files, including images, in the wp-content/uploads directory in your WordPress installation.

WordPress directory structure

By default, WordPress sorts files by upload month and year. For example, if you upload an image in July 2023, it will be in the “2023/07” folder. This makes it easier to manage and organize your files, especially on large sites with a lot of file uploads.

How to change where images are stored?

While WordPress' default settings are sufficient for most users, some may want to change where their images are stored. This may be needed if you want to store files on an external server or elsewhere in your file system.

This can be done with a plugin like WP Original Media Path. This plugin allows you to change the default upload directory. To do this, you need to install and activate the plugin, then go to Settings > Media to configure the path to your new upload folder.

How to use .htaccess and wp-config.php files to change storage location?

Alternatively, advanced users can use the .htaccess and wp-config.php files to change the default upload directory.

To do this, you need to add the following code to the wp-config.php file:

define( 'UPLOADS', 'wp-content/'.'new-images' );

This will cause WordPress to start uploading new files to the “new-images” folder instead of the default “uploads” folder.

On the other hand, if you want to move existing files to a new directory, you need to edit the .htaccess file by adding the following code:

RewriteRule ^wp-content/uploads/(.*)$ wp-content/nowe-obrazy/$1 [L,R=301]

This code will redirect all requests for old files to the new directory.

How to transfer images between servers using plugins?

If you are moving your site to another server, you will need to transfer all images and other media files. Fortunately, there are plugins like Duplicatorthat facilitate this process. Duplicator creates a full backup of your website, which can then be transferred to another server.

In summary, WordPress stores images on its server in the wp-content/uploads directory, but there are many methods you can use to change this setting. From simple use of plugins to more advanced techniques using .htaccess files and wp-config.php, you have many options to choose from. Remember that when manipulating WordPress files and folders, it's always a good idea to back up your site.

Check out the offer of 1500+ Premium WordPress plugins and themes!