I am trying to move the wp-content directory outside of the wordpress directory and hitting all kinds of weird problems. Even though http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder says you can do this, it seems that the directory structure is deeply wired into the WP code. For example, I get error messages like:
PHP message: PHP Warning: file_exists(): open_basedir restriction in effect.
File(/srv/wp.content/themes) is not within the allowed path(s): (/srv/wordpress/:/tmp)
in /srv/wordpress/wp-includes/theme.php on line 369
All I need to do is to move the uploads directory outside of the main hierarchy. I tried to symlink it as well but then I am getting permission errors.
Did anybody manage to successfully have the wp-content directory, or at least, uploads directory outside of the root directory?
You have to define
WP_CONTENT_DIR
andWP_CONTENT_URL
:The new path must be accessible for read and write operation from the WordPress core directory. You might need a helper function to add the new directory path to the
open_basedir
list:Now call it like this:
Came here to find out how to move uploads outside the WordPress root. In the end I kept it as simple as creating a symlink and it works just fine.
Source: Upload folder of WordPress outside the project
For an existing project: