Support » Fixing WordPress » Trouble moving wp-content

  • Resolved Joe Jacobs


    Hey guys,

    I am having a weird problem. I am trying to move wp-content outside of the web root directory. If it makes a difference, wp-config is one level above the web root, in the same directory as wp-content. I changed these two lines in wp-config

    define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' );
    define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/content' );

    I know WordPress has found the new directory because when I installed a new theme it was installed in the right place. But when I activated the theme, I get a bunch of 404s for the theme files. The browser tries to access but gets a 404 error in return. Not sure what I did wrong. Am I missing something obvious here?


Viewing 7 replies - 1 through 7 (of 7 total)
  • Ok done a bit more digging and I found this line in the codex

    Since Version 2.6, you can move the wp-content directory, which holds your themes, plugins, and uploads, outside of the WordPress application directory.

    Previously I took that to mean that I could move wp-content outside of the web root. Maybe I am wrong. Does it just mean I can move it outside the WordPress directory (e.g. if WP is running in a subdirectory) but wp-content would still have to be within the web root?

    For WordPress, your wp-content does not have to be at or under the WordPress directory, but some plugins and themes hard-code the URL to wp-content (ignoring WP_CONTENT_URL and WP_CONTENT_DIR settings).

    It sounds like your particular theme may have this problem. Do you have a URL that shows the problem?

    I am using the twentytwelve theme so I don’t think this should be an issue. Unfortunately I don’t have a URL to show the problem. I am working on a localhost install.

    If you have a way of searching your theme and plugin files you could look for wp-content to find out if the content URL is hardcoded anywhere. And try deactivating all plugins as a test, if you haven’t already. Can your browser access other files in

    I am working on a fresh install, WP 3.5.2, no plugins. I tried accessing the stylesheet URL manually at and get a 404 error. If the request went through WP at all then it would have shown a custom 404 page. But it didn’t. So I’m guessing that means the wp-content directory still needs to be in the web root so that the web server can serve the stylesheet?

    I have a site set up in the same manner as (I think) you are after:

    content is

    WordPress code is in http://www.example com/wp

    wp-config.php is in and includes:
    define( ‘WP_CONTENT_DIR’, dirname( __FILE__ ) . ‘/content’ );
    define( ‘WP_CONTENT_URL’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/content’ );

    index.php is in and includes:
    require( ‘./wp/wp-blog-header.php’ );

    .htaccess is in and is standard:
    `BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress`

    I followed Mark Jaquith’s WordPress Skeleten scheme:

    I had to address hard-coded wp-content URLs in the theme files, the database (in post content), and also in a couple of plugins, but after that it all worked.

    Good luck!

    Hey Martha

    Thanks very much for your help. Yes I ended up using something similar to Mark Jaquith’s WP Skeleton. If anyone is wondering, yes you need wp-content to be in the web root.


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Trouble moving wp-content’ is closed to new replies.