{"id":122,"date":"2008-12-29T14:42:15","date_gmt":"2008-12-29T01:42:15","guid":{"rendered":"http:\/\/www.thunderguy.com\/semicolon\/?p=122"},"modified":"2008-12-29T14:44:24","modified_gmt":"2008-12-29T01:44:24","slug":"separate-wordpress-core-and-content-files","status":"publish","type":"post","link":"https:\/\/thunderguy.com\/semicolon\/2008\/12\/29\/separate-wordpress-core-and-content-files\/","title":{"rendered":"Separate WordPress core and content files"},"content":{"rendered":"<p>Recent WordPress versions have supposedly enabled the ability to separate the core WordPress files from the site-specific files, but I found it hard to find clear information on how to do it. Here&#8217;s the method I ended up using.<\/p>\n<p>For some reason this has been touted as the &#8220;<a href=\"http:\/\/codex.wordpress.org\/Installing_WordPress_With_Clean_Subversion_Repositories\">Clean Subversion Repositories<\/a>&#8221; feature. They really mean &#8220;Clean Subversion Working Copy&#8221;, but in fact Subversion doesn&#8217;t really care about other files in its working copies. The feature is mostly useful for people who <em>don&#8217;t<\/em> have command-line Subversion access in their blog file systems. With the core files separated, you can upgrade simply by deleting and copying in a single directory. This is a big improvement to the previous version, which require a tricky piecemeal copy.<\/p>\n<p>The problem is that there&#8217;s no definitive documentation on how to enable it. It&#8217;s annoying that the WordPress team list this as a new feature, and then leave it up to the users to figure out how to make it work. You could look at the <a href=\"http:\/\/trac.wordpress.org\/ticket\/6938\">Trac ticket<\/a> for this feature for more information. That&#8217;s what I did; if you want to enable it too, you could do worse than start with my method.<\/p>\n<p>Do this at your own risk, of course. It&#8217;s worked for me on the one site I&#8217;ve tried it on, but I haven&#8217;t yet been brave enough to do this on Semicolon yet.<\/p>\n<p>To have your blog at http:\/\/example.com\/semicolon, with the content and config files in <code>\/home\/web\/semicolon\/<\/code>. and the core files in <code>\/home\/web\/semicolon\/wordpress\/<\/code>, here&#8217;s what I would do.<\/p>\n<p>1. Install WordPress in <code>\/home\/web\/semicolon\/wordpress\/<\/code><br \/>\n2. Copy <code>index.php<\/code> from <code>\/home\/web\/semicolon\/wordpress\/<\/code> to <code>\/home\/web\/semicolon\/<\/code><br \/>\n3. Edit your new <code>index.php<\/code>. Replace the line<br \/>\n<code>require('.\/wp-blog-header.php');<\/code><br \/>\nwith<br \/>\n<code>require('wordpress\/wp-blog-header.php');<\/code><br \/>\n4. In WordPress, go to Settings and set your Blog address (URL) to <em>http:\/\/example.com\/semicolon<\/em><\/p>\n<p>Make sure everything works OK. Next comes the scary bit.<\/p>\n<p>5. Move (don&#8217;t copy) <code>wp-config.php<\/code> and <code>wp-content<\/code> from <code>\/home\/web\/semicolon\/wordpress\/<\/code> to <code>\/home\/web\/semicolon\/<\/code><br \/>\n6. Edit your new <code>wp-config.php<\/code>. Add the following lines just before the line that says &#8220;<em>\/* That&#8217;s all, stop editing! Happy blogging. *\/<\/em>&#8221;<\/p>\n<pre><code>define( 'WP_CONTENT_DIR', dirname(__FILE__) . '\/wp-content' );\r\ndefine( 'WP_CONTENT_URL', 'http:\/\/' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '\/wp-content');<\/code><\/pre>\n<p>That&#8217;s all! Test. Enjoy. Now your own files and content are in <code>\/home\/web\/semicolon\/wp-content\/<\/code> and <code>\/home\/web\/semicolon\/wp-config.php<\/code>. All system files are in <code>\/home\/web\/semicolon\/wordpress\/<\/code>, which can safely be deleted and replaced by an upgrade any time.<\/p>\n<p>Now apparently there may still be some problems with plugins and with file uploads. This may explain the <a href=\"http:\/\/codex.wordpress.org\/Installing_WordPress_With_Clean_Subversion_Repositories\">complicated instructions in the WordPress Codex<\/a>, which involve editing the <code>.htaccess<\/code> file. Yikes. A feature that requires you to edit <code>.htaccess<\/code> is an unfinished feature. My method is more like the other Codex method described in <a href=\"http:\/\/codex.wordpress.org\/Editing_wp-config.php\">Editing the config file<\/a>, except it&#8217;s more generic. I haven&#8217;t found any problems yet with my approach &#8212; but that doesn&#8217;t mean you won&#8217;t. Break a leg.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recent WordPress versions have supposedly enabled the ability to separate the core WordPress files from the site-specific files, but I found it hard to find clear information on how to do it. Here&#8217;s the method I ended up using. For some reason this has been touted as the &#8220;Clean Subversion Repositories&#8221; feature. They really mean [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[83],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/comments?post=122"}],"version-history":[{"count":6,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":127,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/posts\/122\/revisions\/127"}],"wp:attachment":[{"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/media?parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/categories?post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thunderguy.com\/semicolon\/wp-json\/wp\/v2\/tags?post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}