Return to Snippet

Revision: 33821
at October 13, 2010 23:34 by lromak


Updated Code
The process to move WordPress into its own directory is as follows:

Create the new location for the core WordPress files to be stored (we will use /wordpress in our examples). (On linux, use mkdir wordpress from your www directory. You'll probably want to use "chown apache:apache" on the wordpress directory you created.)
Go to the General panel.
In the box for WordPress address (URL): change the address to the new location of your main WordPress core files. Example: http://example.com/wordpress
In the box for Site address (URL): change the address to the root directory's URL. Example: http://example.com
Click Save Changes. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)
Move your WordPress core files to the new location (WordPress address).
Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address). The .htaccess file is invisible, so you may have to set your FTP client to show hidden files. If you are not using pretty permalinks, then you may not have a .htaccess file.
Open your root directory's index.php file in a text editor
Change the following and save the file. Change the line that says:
require('./wp-blog-header.php');
to the following, using your directory name for the WordPress core files:
require('./wordpress/wp-blog-header.php');
Login to the new location. It might now be http://example.com/wordpress/wp-admin/
If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)

Revision: 33820
at October 13, 2010 23:33 by lromak


Updated Code
pen your root directory's index.php file in a text editor
Change the following and save the file. Change the line that says:
require('./wp-blog-header.php');
to the following, using your directory name for the WordPress core files:
require('./wordpress/wp-blog-header.php');

Revision: 33819
at October 13, 2010 23:31 by lromak


Initial Code
<p>Many people want WordPress to power their site's root (e.g. <tt>http://example.com</tt>) but they don't want all of the WordPress files cluttering up their root directory.  WordPress allows you to install the WordPress files to a subdirectory, but have your blog exist in the site root.
</p>
<div style="clear:both; background-color:#FFDCDC; border:1px solid #bb0011; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;"><b>WARNING:</b> Multisite users note -</div>
<p><span style="display:block;width:87%;padding-right:5em;padding-left:1em;border-left:1px solid #bb0011;margin-left:1em;">This process is not applicable to and does not work if you have enabled <a href="/Create_A_Network" title="Create A Network">MultiSite</a>.</span>
</p><p>The process to move WordPress into its own directory is as follows:
</p>
<ol><li> Create the new location for the core WordPress files to be stored (we will use <tt>/wordpress</tt> in our examples). (On linux, use mkdir wordpress from your www directory. You'll probably want to use "chown apache:apache" on the wordpress directory you created.)
</li><li> Go to the <a href="/Administration_Panels#Settings" title="Administration Panels">General</a> panel.
</li><li> In the box for <b>WordPress address (URL):</b> change the address to the new location of your main WordPress core files. Example: <tt>http://example.com/wordpress</tt>
</li><li> In the box for <b>Site address (URL):</b> change the address to the root directory's URL. Example: <tt>http://example.com</tt>
</li><li> Click <b>Save Changes</b>. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)
</li><li> Move your WordPress core files to the new location (WordPress address).
</li><li> Copy (NOT MOVE!) the <tt>index.php</tt> and <tt>.htaccess</tt> files from the WordPress directory into the root directory of your site (Blog address). The <tt>.htaccess</tt> file is invisible, so you may have to set your FTP client to <a href="/Changing_File_Permissions#Unhide_the_hidden_files" title="Changing File Permissions">show hidden files</a>. If you are not using <a href="/Using_Permalinks#Using_.22Pretty.22_permalinks" title="Using Permalinks">pretty permalinks</a>, then you may not have a .<tt>htaccess</tt> file.
</li><li> Open your root directory's <tt>index.php</tt> file in a <a href="/Glossary#Text_editor" title="Glossary">text editor</a>
</li><li> Change the following and save the file. Change the line that says:<br /><tt>require('./wp-blog-header.php');</tt><br />to the following, using your directory name for the WordPress core files:<br /><tt>require('./wordpress/wp-blog-header.php');</tt>
</li><li> Login to the new location. It might now be <tt>http://example.com/wordpress/wp-admin/</tt>
</li><li> If you have set up <a href="/Using_Permalinks" title="Using Permalinks">Permalinks</a>, go to the <a href="/Administration_Panels#Permalinks" title="Administration Panels">Permalinks panel</a> and update your Permalink structure. WordPress will automatically update your <tt>.htaccess</tt> file if it has the appropriate file permissions. If WordPress can't write to your <tt>.htaccess</tt> file, it will display the new rewrite rules to you, which you should manually copy into your <tt>.htaccess</tt> file (in the same directory as the main <tt>index.php</tt> file.)
</li></ol>
<a name="Clean_SVN_checkouts" id="Clean_SVN_checkouts"></a><h2> <span class="mw-headline"> Clean SVN checkouts </span></h2>
<p>See <a href="/Installing_WordPress_With_Clean_Subversion_Repositories" title="Installing WordPress With Clean Subversion Repositories">Installing_WordPress_With_Clean_Subversion_Repositories</a>.
</p>
<ul><li>  <a href="http://wordpress.org/support/topic/192612?replies=5#post-825792" class="external text" title="http://wordpress.org/support/topic/192612?replies=5#post-825792">Clean SVN checkout</a> (WordPress support forum)
</li><li>  <a href="http://trac.wordpress.org/ticket/6938" class="external text" title="http://trac.wordpress.org/ticket/6938">Allow wp-content directory to exist in a custom location (not relative to ABSPATH)</a>
</li><li>  <a href="http://trac.wordpress.org/ticket/6933" class="external text" title="http://trac.wordpress.org/ticket/6933">Allow wp-config.php to exist one level up from WordPress root directory</a>
</li></ul>

Initial URL
http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Initial Description


Initial Title
Giving WordPress its Own Directory While Leaving Your Blog in the Root Directory

Initial Tags
wordpress

Initial Language
PHP