WordPress: Giving WordPress Its Own Directory:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == 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. <tt><nowiki>http://example.com</nowiki><...)
 
无编辑摘要
 
第1行: 第1行:
== Giving WordPress its Own Directory While Leaving Your Blog in the Root 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. <tt><nowiki>http://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.
Many people want WordPress to power their site's root (e.g. <tt><nowiki>http://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.
许多人希望将WordPress放到站点的根目录上(如<tt><nowiki>http://example.com</nowiki></tt>)但是他们不希望所有的WordPress文件,搅乱了根目录。WordPress能够使你将WordPress文件安装到子目录上,但是使你的博客安装在站点的根目录上。


The process to move WordPress into its own directory is as follows:
The process to move WordPress into its own directory is as follows:
将WordPress移到自身的目录的过程,如下:


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


== Clean SVN checkouts ==
== Clean SVN checkouts ==
第22行: 第61行:
*  [http://trac.wordpress.org/ticket/6938 Allow wp-content directory to exist in a custom location (not relative to ABSPATH)]
*  [http://trac.wordpress.org/ticket/6938 Allow wp-content directory to exist in a custom location (not relative to ABSPATH)]
*  [http://trac.wordpress.org/ticket/6933 Allow wp-config.php to exist one level up from WordPress root directory]
*  [http://trac.wordpress.org/ticket/6933 Allow wp-config.php to exist one level up from WordPress root directory]
*  [http://wordpress.org/support/topic/192612?replies=5#post-825792 Clean SVN checkout] (WordPress 支持论坛)
*  [http://trac.wordpress.org/ticket/6938 允许 wp-content 目录存在在自定义的位置(与ABSPATH不相关)]
*  [http://trac.wordpress.org/ticket/6933 允许 wp-config.php存在在WordPress根目录的上一级]

2008年8月19日 (二) 16:11的最新版本

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[ ]