一条大河

ZBlog 城市分站二级目录模式配置教程

此文章仅阐述该插件 二级目录模式 的配置方式 泛解析模式 和基础教程请参考:城市分站入门教程

一、开启二级目录模式

插件默认处于泛解析模式,二级目录需要手动开启,如下图

image.png

二、修改服务器伪静态配置

Nginx 伪静态配置如下(推荐)

if (-f $request_filename/index.html){
 rewrite (.*) $1/index.html break;
}

if (-f $request_filename/zb_users/plugin/iddahe_com_city/index.php){
 rewrite (.*) $1/zb_users/plugin/iddahe_com_city/index.php;
}

if (-f $request_filename/index.php){
 rewrite (.*) $1/index.php;
}

if (!-f $request_filename){
 rewrite (.*) /zb_users/plugin/iddahe_com_city/index.php;
}

Apache、IIS 在入口文件添加如下代码即可(最新版插件)

// 找到网站根目录的 index.php 文件,在 “<?php” 之后新起一行粘贴此段代码
require_once __DIR__.'/zb_users/plugin/iddahe_com_city/rewrite.php';

注:关闭插件后,伪静态或添加的代码段需要手动恢复

三、ZBlog 后台 URL 规则配置

配置地址:你的域名/zb_users/plugin/STACentre/main.php (静态管理中心,需要先开启)

该规则不是严格要求的,主要是 URl 规则中需要包含  app-city-path 段,若你不明白此设置,请和我保持一致

文章的URL配置:{%host%}app-city-path/{%id%}.html
页面的URL配置:{%host%}app-city-path/{%id%}.html
首页的URL配置:{%host%}app-city-path/page-{%page%}.html
分类页的URL配置:{%host%}app-city-path/{%alias%}-{%page%}
标签页的URL配置:{%host%}app-city-path/tags-{%id%}-{%page%}.html
日期页的URL配置:{%host%}app-city-path/date-{%date%}-{%page%}
作者页的URL配置:{%host%}app-city-path/author-{%id%}-{%page%}

注:如果你需自定义的地址,且想添加城市目录到 URL 中,请将 app-city-path 添加到你的链接中,格式:你的域名/app-city-path/1.html

四、地图设置,参考下图即可

image.png

若按照上述教程配置好,且没有生效的朋友,请携带订单号和我联系。


发表评论

◎发表您的看法、交流您的观点,保持友善言论。

搜索
近期留言
近期发表
站点标签
©
 iddahe.com / PHP函数速查 / 服务器资源 / 代理IP资源 / 海内外高防CDN / 咨询及反馈 / 需求定制 / 使用协议
一条大河(一会儿是风,一会儿是水) Z-BlogPHP 驱动 / Theme: Hipaper / RSS / Sitemap