2016-11-25

‎Moving a Root install to its own directory: better formatting of commands and file names

← Older revision

Revision as of 19:30, 25 November 2016

Line 19:

Line 19:

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

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 <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.)

+

# Create the new location for the core WordPress files to be stored (we will use <tt>/wordpress</tt> in our examples). (On linux, use
<tt>
mkdir wordpress
</tt>
from your
<tt>
www
</tt>
directory. You'll probably want to use
<tt>
chown apache:apache
</tt>
on the
<tt>
wordpress
</tt>
directory you created.)

# Go to the [[Administration_Panels#Settings|General]] panel.

# Go to the [[Administration_Panels#Settings|General]] panel.

# In the box for '''WordPress address (URL):''' change the address to the new location of your main WordPress core files. Example: <tt><nowiki>http://example.com/wordpress</nowiki></tt>

# In the box for '''WordPress address (URL):''' change the address to the new location of your main WordPress core files. Example: <tt><nowiki>http://example.com/wordpress</nowiki></tt>

Line 25:

Line 25:

# 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.)

# 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).

# Move your WordPress core files to the new location (WordPress address).



# 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 [[Changing_File_Permissions#Unhide_the_hidden_files|show hidden files]]. If you are not using [[Using_Permalinks#Using_.22Pretty.22_permalinks|pretty permalinks]], then you may not have a .<tt>htaccess</tt> file. <i><b>If you are running WordPress on a Windows (IIS) server</b> and are using pretty permalinks, you'll have a <tt>web.config</tt> rather than a <tt>.htaccess</tt> file in your WordPress directory. For the <tt>index.php</tt> file the instructions remain the same, copy (don't move) the index.php file to your root directory. The web.config file, must be treated differently than the .htaccess file so you must MOVE (DON'T COPY) the <tt>web.config</tt> file to your root directory.</i>

+

# 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 [[Changing_File_Permissions#Unhide_the_hidden_files|show hidden files]]. If you are not using [[Using_Permalinks#Using_.22Pretty.22_permalinks|pretty permalinks]], then you may not have a .<tt>htaccess</tt> file. <i><b>If you are running WordPress on a Windows (IIS) server</b> and are using pretty permalinks, you'll have a <tt>web.config</tt> rather than a <tt>.htaccess</tt> file in your WordPress directory. For the <tt>index.php</tt> file the instructions remain the same, copy (don't move) the index.php file to your root directory. The
<tt>
web.config
</tt>
file, must be treated differently than the
<tt>
.htaccess
</tt>
file so you must MOVE (DON'T COPY) the <tt>web.config</tt> file to your root directory.</i>

# Open your root directory's <tt>index.php</tt> file in a [[Glossary#Text editor|text editor]]

# Open your root directory's <tt>index.php</tt> file in a [[Glossary#Text editor|text editor]]

# Change the following and save the file. Change the line that says:<br /><tt>require( dirname( __FILE__ ) . '/wp-blog-header.php' );</tt><br />to the following, using your directory name for the WordPress core files:<br /><tt>require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );</tt>

# Change the following and save the file. Change the line that says:<br /><tt>require( dirname( __FILE__ ) . '/wp-blog-header.php' );</tt><br />to the following, using your directory name for the WordPress core files:<br /><tt>require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );</tt>

Show more