I want to uncheck the "organize my uploads into month- and year-based folders" option in my WordPress site, but a previous version of my site had that checkbox checked. There are links and other references to those folders in URLs throughout the site. Is there a way to globally update this? Or perhaps I can fix it with an .htaccess rewrite of some kind?
So that this:
https://example.com/wp-content/uploads/2018/04/catalog.pdf
Would need to become:
https://example.com/wp-content/uploads/catalog.pdf
I think Better Search Replace can handle globally updating image paths stored throughout the database (backup the database first for sure).
If everything is in /uploads, searching for '/uploads/XXXX/XX/' and replacing with '/uploads/' should suffice. You could redirect with wildcards in .htaccess but to me the data is still wrong and this approach only masks it.
Scratch the following:
Make sure the default Media Library location is set to the /catalog folder going forward after unchecking the 'organize my uploads into month- and year-based folders' in Wordpress if you haven't. In wp-config.php, add:
define('UPLOADS', 'wp-content/uploads/catalog');
Edit: misread OP's original question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With