Make WordPress upload directory outside wordpress root with custom url

If all you want to do is to have a “cdn” type url, the easiest solution that do not require any programing is to make HostPath/project.dev/cdn a symlink to project.dev/wp-content/uploads. This way for theOS both paths are essentially the same. This should be easy to do if you are in full control of the server and/or have SSH access, or might require help from your hosting if you do not have this kind on access.

Another option if you have control on the web server configuration is to map the “document root” of the cdn.project.dev to the dev/wp-content/uploads directory.

Putting the uploaded files outside of the wordpress directory tree,as the question literally asks, is not a great idea as it is likely to break all kinds of external tools like backup utilities.

Leave a Comment