I’m just looking into roots and enabled the option to change the upload directory to “media” but this poses a small problem. I’ve organised my project structure (as shown in the Composer blogpost) to have all WP core files in the “wp” directory and moved the “wp-content” directory outside of the “wp” directory. Any plugins and themes are now located outside of the “wp” directory.
Problem is that the “media” directory is now located inside the “wp” directory instead of alongside the “wp” and “wp-content” directories.
The relevant part of the configuration (I think) is:
/* Run WordPress from a subdirectory */
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/roots/wp');
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] . '/roots');
/* Separate the wp-content directory from the WordPress install */
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/roots/wp-content');
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/roots/wp-content');
Thanks for this. I haven’t started using Composer quite yet. However I had a related question as to how is the rewrite for changing to the /media/ directory handled? Is this added to the .htaccess folder?
I’ve been having a few issues on a number of sites where I get loads of 404s because the site thinks the image files are in the wrong directory. I’ve got confused as to whether they should be in /media/ or /assets/ in the root directory (i.e. not in the theme directory)
The change of upload folder is not handled by a rewrite rule but rather internally by WordPress.
You can use the following rules (that is, I use these rules): things that are needed to display your site properly should be in the assets folder, anything content related should be in the media folder.