WordPress建站技巧:将程序放在自定义目录中

前端之家收集整理的这篇文章主要介绍了WordPress建站技巧:将程序放在自定义目录中前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

很多站长朋友在使用wordpress建站的过程中,不想把整套网站程序放在根目录,而是想放在某个文件夹中。这篇wordpress教程里,我们就向大家介绍一下方法,实现的步骤如下:

1. 创建文件夹(例如wordpress),用来放置wordpress程序。
2. 到后台中的基础设置中,在wordpress address (URL)选项中输入wordpress程序所在的文件夹,如 http://example.com/wordpress,在Site address (URL)选项中填写wordpress根目录对应的链接,如 http://example.com,保存更改(忽略前台的一些错误信息,例如文件不存在等错误信息)。
3. 将wordpress程序移动到第一步创建的文件夹中。
4. 将index.PHP 和 .htaccess 文件拷贝到更目录(注意是拷贝,不要移动),.htaccess 是隐藏文件,所以要在FTP客户端中设置显示隐藏文件。打开根目录下的index.PHP文件,将以下代码

Crayon-5c891cf8b57d4263912781" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">wp-config.php
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891cf8b57d4263912781-1">1
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891cf8b57d4263912781-1">Crayon-e">requireCrayon-sy">(Crayon-h"> Crayon-e">dirnameCrayon-sy">(Crayon-h"> Crayon-v">__FILE_Crayon-sy">_Crayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">.Crayon-h"> Crayon-s">'/wp-blog-header.PHP'Crayon-h"> Crayon-sy">)Crayon-sy">;

更改为:

Crayon-5c891cf8b57dd866082582" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">wp-config.php
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891cf8b57dd866082582-1">1
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891cf8b57dd866082582-1">Crayon-e">requireCrayon-sy">(Crayon-h"> Crayon-e">dirnameCrayon-sy">(Crayon-h"> Crayon-v">__FILE_Crayon-sy">_Crayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">.Crayon-h"> Crayon-s">'/wordpress/wp-blog-header.PHP'Crayon-h"> Crayon-sy">)Crayon-sy">;

5. 登录wordpress后台地址 http://example.com/wordpress/wp-admin/

6. 如果您已开启静态链接,请到后台的设置中,更新静态链接wordpress自动更新.htaccess文件,如果权限不够,您需要手动更新.htaccess文件,将后台显示的重写规则拷贝到.htaccess文件中保存即可。

7. 搞定。

原文链接:https://www.f2er.com/wordpress/238425.html

猜你在找的wordpress相关文章