WordPress 中文文档
Giving WordPress Its Own Directory
出自WordPress Chinese 中文文档
wordpress.org.cn
Giving WordPress its Own Directory While Leaving Your Blog in the Root Directory
Many people want WordPress to power their site's root (e.g. ttnowikihttp://example.com/nowiki/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.
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.)
- 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: ttnowikihttp://example.com/wordpress/nowiki/tt
- In the box for Blog address (URL): change the address to the root directory's URL. Example: ttnowikihttp://example.com/nowiki/tt
- 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 the ttindex.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 show hidden files. If you are not using pretty permalinks, then you may not have a .tthtaccess/tt file.
- Open your root directory's ttindex.php/tt file in a text editor
- Change the following and save the file. Change the line that says:br /ttrequire('./wp-blog-header.php');/ttbr /to the following, using your directory name for the WordPress core files:br /ttrequire('./wordpress/wp-blog-header.php');/tt
- Login to the new location. It might now be ttnowikihttp://example.com/wordpress/wp-admin//nowiki/tt
- If you have set up Permalinks, go to the Permalinks panel 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 ttindex.php/tt file.)
Clean SVN checkouts
See Installing_WordPress_With_Clean_Subversion_Repositories.
- Clean SVN checkout (WordPress support forum)
- Allow wp-content directory to exist in a custom location (not relative to ABSPATH)
- Allow wp-config.php to exist one level up from WordPress root directory
WordPress MU
Please note, this procedure will not work in WordPress MU or in WordPress 3.0 with multisite enabled. It interferes with the member blog lookup.

