Upload dir to wp-content/uploads

Hi,
I want to change my upload dir from “web/app/uploads” to “web/wp-content/uploads” (not in wp/wp-content).
I saw this discussion Bedrock and UPLOAD dir but I don’t found a solution:
define(‘UPLOAD’,‘wp-content/uploads’);
_update_option(‘upload_path’, $SERVER[‘DOCUMENT_ROOT’] . ‘/wp-content/uploads’);
_update_option(‘upload_url_path’, ‘http://’ . $SERVER[‘SERVER_NAME’] . ‘/wp-content/uploads’’);
doesn’t work.

I want to change it because I use WP Offload s3 and, if I change the upload dir, it replace all my OLD images with the new path (app/uploads).

Thanks

What about just having a NGINX 301 redirect from your old URLs to your new URLs so that if people try an access the old URLs they are permanently redirected to the correct new URLs. This is also SEO friendly.

If you want to do it this way, which in my opinion is better, let me know the old and new URLs and I’ll give you the code you need.

Also you may need to do a find-replace in your database for the old URLs in posts/pages

wp search-replace --precise --recurse-objects '/wp-content/uploads/' '/app/uploads/'

Or similar…

1 Like