wordpress 子目录_在整个网站上工作时将WordPress安装在子目录中

本文介绍了如何在网站的子目录中安装WordPress,以保持网站的整洁。过程包括创建新目录,更改WordPress和站点地址的URL,移动核心文件,复制index.php和.htaccess文件,并更新相关路径。登录新位置后,如果使用了永久链接,记得更新Permalink结构。
摘要由CSDN通过智能技术生成

wordpress 子目录

How to install WordPress in a sub directory while working for the whole site? Putting the WordPress files in the root directory seems messy.

在整个网站上工作时,如何在子目录中安装WordPress? 将WordPress文件放在根目录中似乎很麻烦。

A method is introduced here: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

这里介绍一种方法: http : //codex.wordpress.org/Giving_WordPress_Its_Own_Directory

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). (On linux, use mkdir wordpress from your www directory. You’ll probably want to use “chown apache:apache” on the wordpress directory you created.)

    为要存储的核心WordPress文件创建新位置(在示例中,我们将使用/ wordpress)。 (在Linux上 ,从www目录中使用mkdir wordpress。您可能要在创建的wordpress目录中使用“ chown apache:apache”。)

  2. 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: http://example.com/wordpress
    In the box for Site address (URL): change the address to the root directory’s URL. Example: http://example.com
    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.)

    转到常规面板。
    在WordPress地址(URL)框中:将地址更改为主要WordPress核心文件的新位置。 示例:http://example.com/wordpress
    在“站点地址(URL)”框中:将地址更改为根目录的URL。 范例: http//example.com
    单击保存更改。 (不要担心错误信息,不要试图看到您的博客在这一点 !你可能会得到一个关于找不到文件的消息。)

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

    将您的WordPress核心文件移动到新位置(WordPress地址)。

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

    将WordPress目录中的index.php和.htaccess文件复制(不移动!)到您网站的根目录(博客地址)中。 .htaccess文件是不可见的,因此您可能必须将FTP客户端设置为显示隐藏文件。 如果您没有使用漂亮的永久链接,则可能没有.htaccess文件。

  5. Open your root directory’s index.php file in a text editor

    在文本编辑器中打开根目录的index.php文件

  6. 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’);

    更改以下内容并保存文件。 更改以下行:
    require('./ wp-blog-header.php');
    使用WordPress核心文件的目录名称进行以下操作:
    require('./ wordpress / wp-blog-header.php');

  7. Login to the new location. It might now be http://example.com/wordpress/wp-admin/
    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.)

    登录到新位置。 现在可能是http://example.com/wordpress/wp-admin/
    如果已设置永久链接,请转到“永久链接”面板并更新您的永久链接结构。 如果WordPress具有适当的文件权限,它将自动更新.htaccess文件。 如果WordPress无法写入您的.htaccess文件,它将向您显示新的重写规则,您应该将其手动复制到.htaccess文件中(与主index.php文件位于同一目录中)。

Answered by anonymous.
匿名回答。

翻译自: https://www.systutorials.com/installing-wordpress-in-a-sub-directory-while-working-for-the-whole-site/

wordpress 子目录

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值