个人工具
名字空间
变换
操作

WordPress:Giving WordPress Its Own Directory

来自站长百科
跳转到: 导航, 搜索

目录

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

设置单独的WordPress目录,将你的博客放到根目录上

Many people want WordPress to power their site's root (e.g. http://example.com) 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.

许多人希望将WordPress放到站点的根目录上(如http://example.com)但是他们不希望所有的WordPress文件,搅乱了根目录。WordPress能够使你将WordPress文件安装到子目录上,但是使你的博客安装在站点的根目录上。

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

将WordPress移到自身的目录的过程,如下:

  1. Create the new location for the core WordPress files to be stored (we will use /wordpress in our examples).
  1. 为WordPress核心文件,创建新的安装位置(在这个例子中,我们使用/wordpress)。
  1. Go to the Options panel.
  1. 进入选项面板。
  1. 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
  1. WordPress 地址 (URL):框中,将地址更改为WordPress主要的核心的文件的新地址。例如:http://example.com/wordpress
  1. In the box for Blog address (URL): change the address to the root directory's URL. Example: http://example.com
  1. 博客地址(URL):框中,将地址更改为根目录的URL。例如:http://example.com
  1. Click Update Options. (Do not worry about the error message and do not try to see your blog at this point!)
  1. 点击更新选项。(不要管那些错误信息,这时不要尝试查看你的博客!)
  1. Move your WordPress core files to the new location (WordPress address).
  1. 将WordPress核心文件移到新的位置(WordPress地址)。
  1. Copy the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address).
  1. 将WordPress目录中的index.php.htaccess文件,复制到你的站点的根目录上(博客地址)。
  1. Open your root directory's index.php file in a text editor
  1. 文本编辑器中打开你的根目录的index.php文件
  1. 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');
  1. 更改下面内容并且保存文件。将
    require('./wp-blog-header.php');
    行,更改为下面的内容,将目录名用于WordPress核心文件:
    require('./wordpress/wp-blog-header.php');
  1. Login to the new location. It might now be http://example.com/wordpress/wp-admin/
  1. 登录到新的地址。现在地址可能是http://example.com/wordpress/wp-admin/
  1. 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.)
  2. 如果你已经设置了Permalinks,进入Permalinks 面板并且更新你的Permalink结构。如果你的.htaccess文件有适当的权限,WordPress就会自动更新这个文件。如果WordPress不能编写你的.htaccess文件,这个文件会向你显示新的rewrite规则,你可以动手将这个规则复制到.htaccess文件(与主要的index.php文件在同一个目录。)

Clean SVN checkouts

Clean SVN checkouts


留言