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


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. The process to move WordPress into its own directory is as follows:
  2.  
  3. 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.)
  4. Go to the General panel.
  5. 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
  6. In the box for Site address (URL): change the address to the root directory's URL. Example: http://example.com
  7. 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.)
  8. Move your WordPress core files to the new location (WordPress address).
  9. 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.
  10. Open your root directory's index.php file in a text editor
  11. Change the following and save the file. Change the line that says:
  12. require('./wp-blog-header.php');
  13. to the following, using your directory name for the WordPress core files:
  14. require('./wordpress/wp-blog-header.php');
  15. Login to the new location. It might now be http://example.com/wordpress/wp-admin/
  16. 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.)

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.