Home » Web Tutorials » WordPress » How to Change Default Media Uploads Folder in WordPress?

How to Change Default Media Uploads Folder in WordPress?

Default Media Saving in WordPress

WordPress by default saves all media files like images, videos and PDFs under the directory called “Uploads”. For example you can view an uploaded image in your site using the following path:

https://www.yoursitename.com/wp-content/uploads/media-file-name.png

You have an option to arrange the media files in monthly folders under each year. You can enable the option “Organize my uploads into month- and year-based folders” available under “Settings > Media > Uploading File” section. With this option enable, you can view an image file uploaded on September 2026 in your site with the following URL:

https://www.yoursitename.com/wp-content/uploads/2026/09/media-file-name.png
Save Media File Under Month and Year
Save Media File Under Month and Year

Why You Need to Change Default Media Uploads Folder in WordPress?

It is easy to use the default setup as it is. However, you may have some problems or need to change the default media uploads folder in WordPress.

  • Whenever the webpage is loaded, browser will trigger separate HTTP request to server for every single image on the page putting lot of load on the server. This will adversely affects the page loading speed. You can serve images from a subdomain or another domain to send parallel HTTP requests during the page load.
  • If you are using cookies (many plugins use cookies in WordPress), you can serve images from a cookiless domain. This will help to eliminate the page speed issues with serve static files from cookiless domains.
  • Having lots of images in default uploads folder will affect your regular backup and restoring. You can keep the images in separate folder to manage them easily.

Change Default Media Uploads Folder in WordPress

For any reason, if you want to change the default media uploads folder in WordPress to a custom user defined folder, here is the step by step tutorial. You have two possibilities to change the upload folder:

  1. Create a new folder within your WordPress installation
  2. Create a new folder on a subdomain outside your WordPress installation

We will explain both the option in detail in the following section.

1. Creating Custom Folder Within WordPress Installation

This will help in added security by moving all your media files outside the /wp-content folder. Below are the basic steps involved in this process:

  • Creating a new folder for uploading
  • Modifying wp-config.php file
  • Moving existing media files to new folder
  • Check and correct broken media links
  • Upload media file and check permissions

Only first two steps are needed for a new WordPress site and all steps are needed for an existing site already having media files.

Step 1 – Creating New Folder

Assuming you want to store all your media files under the directory called “media” then you need to first create a folder name in your root WordPress installation with a name “media”. You can create a folder either using FTP or using “File Manager” option accessible within your hosting account. Here we explain the File Manager option available with standard cPanel. You can follow similar steps if you are using custom hosting panel like in case of SiteGround Site Tools.

Login to you hosting account, search for “File Manager” app and open it.

Open File Manager in Bluehost
Open File Manager in Bluehost

Choose the root direct where you have installed WordPress.

File Manager Directory Selection in Bluehost
File Manager Directory Selection in Bluehost

Choose “Web Root (public_html/)” if you installed WordPress in your root directory or select the sub-directory from “Document Root for” drop-down if you installed WordPress on sub-domain or sub-directory. In this example, WordPress is installed in a sub-domain “wordpress.webnots.com”, so we create a new folder with the name “media” under the directory “wordpress”.

Click on the “New Folder” icon as shown in the below picture.

Create New Folder
Create New Folder

In the pop-up window enter the new folder name, check your root directory is correct and click on the “Create New Folder” button.

Enter Folder Name
Enter Folder Name

You can see the new folder with the name “media” is created under your WordPress installation.

New Media Folder Created
New Media Folder Created

Step 2 – Modify “wp-config.php” File

The next step is to modify “wp-config.php” file located under your WordPress installation root directory (normally “/public_html”). Click on the “Edit” icon in the “File Manager” as shown in the below picture.

Locate wp-config PHP File
Locate wp-config PHP File

If prompted, choose “utf-8” encoding in the pop-up and click on “Edit” button (You will not see this pop-up if encoding is disabled).

Choose Encoding for Text Editor
Choose Encoding for Text Editor

Add the following code in “wp-config.php” file and save your changes. The first line is a comment line for future reference, you can delete this line if not needed.

/** Change Media Upload Directory */
define('UPLOADS', ''.'media');

It should look like below in the file:

Add Code for Changing Media Folder
Add Code for Changing Media Folder

Ensure to add correct quotation marks in the code. Copying the code from text editor like Microsoft Word will add different type of quotes in WordPress and makes the code not effective. Also, make sure to add the code just above line “/*That’s all, stop editing! Happy blogging. */”

You can also use FTP software like FileZilla to modify and upload “wp-config.php” file back to server.

Edit wp-config Using FileZilla
Edit wp-config Using FileZilla

Step 3 – Moving Existing Files to New Media Folder

Once you changed “wp-config.php” file, all existing media attachments in your WordPress site will be automatically changed with the URL “https://www.yoursitename.cm/media/media-file-name”. This will result in broken media links in all your posts and pages. You need to move all existing files to new “media” folder to adjust the broken links. You can do this either by FTP or inside your “File Manager” by just dragging and dropping all the media files from old directory to new directory.

Move Existing Files to New Media Folder
Move Existing Files to New Media Folder

Important Note: Though images uploaded through FTP or File Manager will show on the published site, you will not be able to see them under “Media > Library” section in admin panel. Unfortunately, WordPress will only show the files uploaded from the admin panel under media library. Follow the instructions in our article on fixing FTP images not showing in Media Library. In addition, you may need to check and change image hotlinking location if you are not able to see the images of published site in the browser.

Step 4 – Check For Broken Links

The final step is to check for any missed broken links of media files in your site. You can use plugins or external websites to find any broken links and correct them manually. Any new media file uploaded in your site will be stored under the new “media” folder.

Step 5 – Upload Media File and Check Permissions

Finally upload an image and check the file path that it is stored in new “media” folder created. If you see image not found or 403 error then the probable reason could be file permission settings of newly created folder. In order to check the file permissions, connect your FTP software to the server and navigate to the folder. Right click and select the option “File Permissions…”.

Change File Permission Settings in FileZilla
Change File Permission Settings in FileZilla

Ensure to select appropriate permission settings and the numeric value should be 755.

Setting File Permissions in FileZilla
Setting File Permissions in FileZilla

2. Creating Custom Folder on Subdomain Outside WordPress Installation

Storing media files on external domain provides lot of flexibilities like independent backup, faster site loading in addition to added security. As mentioned, by loading images from external subdomain, all images can be loaded in parallel thus increasing the page loading speed. Refer the step by step tutorial on hosting images on subdomain in WordPress.

Try out one of these options and leave your comments if you face any problem.

26 thoughts on “How to Change Default Media Uploads Folder in WordPress?”

  1. Hi,
    Thanks for this information i was searching for this but actually i wanted to make some option to create image folders using category name … so that images of a category of blog are in different folder making the path seo friendly ..

    Can’t it be done using code instead of changing the actual physical path … ?

  2. Prabhat Chaudhary

    Hi,

    I want to change uploads folder >> files.

    I have created a new folder and edited wp-config file.

    Now wp is not opening.

    How to fix?

  3. Hello,
    Thank you for this instruction. I added the code to the wp-config.php file and it works in that if I add a new image to the media library, it goes into the new ‘images’ file. The problem is that all of the images in the media library already, now show as broken in the library.

    All of the old images are in the new ‘images’ file, in fact they were already in there because this system was already set up before I moved the site to a new server and the config file changed. When I changed it back with this code, it is having the above problem.

    define(‘UPLOADS’, ‘images’);

  4. The change to wp-config.php will actually break your site. The instructions are wrong — the missing double quote will cause a server error. Just google for different instructions and you’ll find some that don’t break your site.

    1. WebNots Admin

      We use preformated text for codes to retain the quotes, however make sure you check when pasting on your configuration file.

      On side note – no matter from which website you are copying, make sure to take care of single and double quotes.

  5. This is the fix recommended by all WP advice sites. Unfortunately, changing wp-config not only changes the default for uploaded media, but also changes the default used by some themes and page builders (e.g. Elementor).

    Once I saw this, I restored the original setting – organizing media by upload month is just brain-dead, but it’s the only way to isolate uploaded media from the other content created by themes and plugins…

    IMO, making this change is a bit risky.

    1. Editorial Staff

      That’s the intended purpose of changing the media folder similar to storing all static files in Uploads folder. Otherwise, you will get lost if some files are in media folder and some are in uploads folder.

      That’s also the reason plugin developers refer the upload file path from configuration settings. If you want your plugin to follow the uploads folder then change the settings only within the plugin leave the global settings as it is.

  6. Is it possible to change un-select “Organize my uploads into month- and year-based folders” on a LIVE site? Are the current images and pdf files path changing too?

  7. Good Day,

    When I type in your code in my cPanel using Edit, it breaks my site with a white screen and no error. When I remove the code, my site works again. I did use the 4 single quotes and 1 double, plus copy/dragged all images to new folder. Permission is correct on the folder I wish to use instead of /uploads. My new folder had a dash, so I tried removing that without success

    I am working on a Duplicator plugin copy of my sites to change things up without touching the live ones. Good thing or my live site would go down. Though I’m not sure why working on a copy would be any different … Could this be the reason?

    In other words, instead of working on nameofsite.com, I’m working on test.nameofsite.com On this particular site, I’m using a WP version back a few, albeit don’t think that would matter.

    Thanks in advance and Merry Christmas to you & yours!

    1. Please disregard. I figured out that I needed to add your code to a different place within the config file. Namely beneath the require_once(ABSPATH…. bit. Now it works perfectly! Thanks!

      1. Glad to know you find it yourself, you shall add the code just above the line “/* That’s all, stop editing! Happy blogging. */”

        1. But if I do that, then it breaks my site. As I stated above, I had to put it at the end of my config file after

          require_once(ABSPATH ….

          Not before the “/* That’s all, stop editing! Happy Blogging! */”

          Perhaps it’s a plugin or my theme that causes me to place it differently? Anyway it works so no worries :) Thanks again!

  8. Hello,

    My site no longer loads and I get the following error after trying to set this up?

    Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /home/websitename/public_html/wp-config.php on line 84

    Could you advise me on what I did wrong? Your instructions were very succinct so I’m surprised by the outcome I’m getting?

    Thanks in advance

    1. Check the quotes you used in the code. As already highlighted in the article, if you copy from text editor the single / double quotes will be in different format which will not be parsed and show error.

      1. First of all thank you for getting back to me! I actually figured out the problem steming from the double quote vs two single quotes. That being said in the WP Dashboard, whenever I select <> WP still attempts to look for the folder in it’s previous location? I haven’t been able to figure out why it will not look in it’s new location (running WP 4.0). I really wanted my media files outside for wp-content folder…If you have any recommendations I would appreciate it!

        1. Are you referring the URL (…/wp-admin/upload.php) in browser’s address bar when you click on “Media” inside WordPress admin dashboard? If yes, it is a “Media Library administration panel” file stored under your “wp-admin” folder as “upload.php” which will not affect where your files should be stored.

          To check file path, upload a new file and check the “File URL” which should show the new folder. Or if you have any existing images on your site, right click and copy image URL, which should show that the image is stored under the new “media” folder you created.

          1. Thanks for this info, i as a beginner was also looking that URL. Now that i checked and everything is working fine.

Leave a Comment

Your email address will not be published. Required fields are marked *