蚂蚁分类信息系统伪静态-蚂蚁分类信息系统(MayiCMS / mymps)配置伪静态规则

admin3个月前网络知识115

为蚂蚁分类信息系统(MayiCMS / mymps)配置伪静态,通常分为两步:在服务器添加规则,并在网站后台开启功能。以下主要针对 Nginx 环境,并补充 Apache 和 IIS 的说明。

🖥️ Nginx 环境伪静态规则

1. 单城市 PC 站规则

适用于 http://域名/分类拼音/123.html 这类 URL 格式。将以下规则添加到站点配置文件的 server { ... } 块中:

nginx

location / {

if (!-e $request_filename) {

rewrite ^/(.+)/([0-9]+).html$ /information.php?id=$2 last;

rewrite ^/(.+)/$ /list.php?catdir=$1 last;

rewrite ^/$ /index.php last;

}

}

此规则会将动态 URL 重写为对 information.php 和 list.php 的调用,并传递相应参数。

2. 多城市版 + 手机自适应规则

此规则可实现 PC 和手机端共用一个伪静态链接,并根据 User-Agent 自动跳转。将以下规则放入 Nginx 的 server 块内:

nginx

判断是否为手机端 UA

if ($http_user_agent ~* "(MIDP)|(WAP)|(UP.Browser)|(Smartphone)|(Obigo)|(Mobile)|(AU.Browser)|(wxd.Mms)|(WxdB.Browser)|(CLDC)|(UP.Link)|(KM.Browser)|(UCWEB)|(SEMC-Browser)|(Mini)|(Symbian)|(Palm)|(Nokia)|(Panasonic)|(MOT-)|(SonyEricsson)|(NEC-)|(Alcatel)|(Ericsson)|(BENQ)|(BenQ)|(Amoisonic)|(Amoi-)|(Capitel)|(PHILIPS)|(SAMSUNG)|(Lenovo)|(Mitsu)|(Motorola)|(SHARP)|(WAPPER)|(LG-)|(LG/)|(EG900)|(CECT)|(Compal)|(kejian)|(Bird)|(BIRD)|(G900/V1.0)|(Arima)|(CTL)|(TDG)|(Daxian)|(DAXIAN)|(DBTEL)|(Eastcom)|(EASTCOM)|(PANTECH)|(Dopod)|(Haier)|(HAIER)|(KONKA)|(KEJIAN)|(LENOVO)|(Soutec)|(SOUTEC)|(SAGEM)|(SEC-)|(SED-)|(EMOL-)|(INNO55)|(ZTE)|(iPhone)|(Android)|(Windows CE)|(Wget)|(Java)|(curl)|(Opera)") {

# 城市选择页

rewrite ^/(.*[/]?)city/$ /m/?mod=changecity&cityid=0 last;

# 资讯模块

rewrite ^/(.*[\/]?)news\.html$ /m/index.php?mod=news last;

rewrite ^/(.*[\/]?)news-page-([0-9]+)\.html$ /m/index.php?mod=news&page=$2 last;

rewrite ^/(.*[\/]?)news/([0-9]+)\.html$ /m/index.php?mod=news&id=$2 last;

rewrite ^/(.*[\/]?)news-id-([0-9]+)\.html$ /m/index.php?mod=news&id=$2 last;

rewrite ^/(.*[\/]?)news-catid-([0-9]+)\.html$ /m/index.php?mod=news&catid=$2 last;

rewrite ^/(.*[\/]?)news-catid-([0-9]+)-page-([0-9]+)\.html$ /m/index.php?mod=news&catid=$2&page=$3 last;


# 单页(关于我们、公告等)

rewrite ^/(.*[\/]?)aboutus\.html$ /m/index.php?mod=aboutus last;

rewrite ^/(.*[\/]?)aboutus-id-([0-9]+)\.html$ /m/index.php?mod=aboutus&id=$2 last;

rewrite ^/(.*[\/]?)announce\.html$ /m/index.php?mod=announce last;

rewrite ^/(.*[\/]?)announce-id-([0-9]+)\.html$ /m/index.php?mod=announce&id=$2 last;


# 商品/黄页

rewrite ^/(.*[\/]?)goods\.html$ /m/index.php?mod=goods last;

rewrite ^/(.*[\/]?)goods-id-([0-9]+)\.html$ /m/index.php?mod=goods&id=$2 last;

rewrite ^/(.*[\/]?)goods-([^\/]+)\.html$ /m/index.php?mod=goods&Catid=$2 last;

rewrite ^/(.*[\/]?)corporation\.html$ /m/index.php?mod=corp last;

rewrite ^/(.*[\/]?)corporation-([^\/]+)\.html$ /m/index.php?mod=corp&Catid=$2 last;


# 店铺

rewrite ^/(.*[\/]?)store-([0-9]+)/$ /m/index.php?mod=store&id=$2 last;

rewrite ^/(.*[\/]?)store-([0-9]+)/([^\/]+)\.html$ /m/index.php?mod=store&id=$2&Uid=$3 last;

rewrite ^/(.*[\/]?)store-([0-9]+)/document-id-([0-9]+)\.html$ /m/index.php?mod=store&id=$2&action=document&docuid=$3 last;

rewrite ^/(.*[\/]?)store-([0-9]+)/document-typeid-([0-9]+)\.html$ /m/index.php?mod=store&id=$2&action=document&typeid=$3 last;


# 分类列表

rewrite ^/category/$ /m/index.php?mod=category last;

rewrite ^/(.+)/$ /m/index.php?mod=category&Catid=$1 last;

rewrite ^/(?!store|space|news)(.+[\/]?.+)/$ /m/index.php?mod=category&Catid=$1 last;


# 信息详情页(核心规则)

rewrite ^/(.+[\/]?.+)/([0-9]+)\.html$ /m/index.php?mod=information&id=$2 last;


# 兼容入口 index.php

rewrite ^/index\.php(.*)$ /m/index.php$1 last;


}

💡 提示:若使用宝塔面板,可直接在“网站”->“伪静态”设置中选择 Nginx,粘贴以上规则并保存。

⚙️ 后台开启伪静态

添加规则后,还需在蚂蚁分类系统后台开启相应功能:


登录网站后台。

进入 系统 → SEO伪静态(部分版本可能在“系统设置”内)。

找到“页面详细显示方式”,选择“伪静态”和“拼音伪静态”,然后提交保存。

进入 站务 → 链接导航,将主导航和尾部导航恢复为“默认导航”,以防链接出错。


📁 Apache / IIS 环境


Apache:将规则写入网站根目录的 .htaccess 文件。需确保 Apache 配置中 AllowOverride All 已开启。

IIS 6:通过“ISAPI 筛选器”加载 rewrite.dll。

IIS 7+:将 web.config 文件上传至网站根目录。


🔍 常见问题排查


规则不生效:检查伪静态功能是否在后台开启;确认规则是否已正确加载(Nginx 需重载配置,Apache/IIS 需重启服务);检查域名是否绑定在正确的站点上。

页面 404/500:检查规则中的正则表达式是否与您的 URL 结构完全匹配;确认对应的 PHP 文件(如 information.php)存在于网站目录中。

手机端跳转失败:检查 User-Agent 匹配规则是否过于严格或遗漏;确认手机端模板文件已正确部署。


免责声明:本文内容来自用户上传并发布,站点仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。请核实广告和内容真实性,谨慎使用。

相关文章

黄易作品大全集txt下载-黄易小说全集

黄易作品大全集txt下载-黄易小说全集

黄易小说全集总共收录了黄易大师的40部武侠小说作品,包括:大唐双龙传、大剑师传奇、魔女殿、光神、乌金血剑、寻秦记、星际浪子、域外天魔等。对于黄易小说迷来说绝对是福利啊!让你一次看个够!赶快下载体验吧!...

盘搜搜官方网站登录_盘搜搜网页版官网首页

盘搜搜官方网站登录入口地址是https://pansou.cc,支持百度、阿里云、夸克等多网盘聚合搜索,无需注册登录,界面简洁无广告,具备智能联想、链接检测、中文长句检索等功能。盘搜搜官方网站登录入口...

ArchiveofOurOwn小说平台-ArchiveofOurOwn看文网站官方入口

ArchiveofOurOwn小说平台-ArchiveofOurOwn看文网站官方入口

ArchiveofOurOwn官方入口为https://archiveofourown.org/,用户可直接访问并使用多语言界面,通过邀请注册账号,利用高级搜索与筛选功能查找作品,管理收藏...

抖音怎么改抖音名字-抖音app更改名字的方法教程

抖音怎么改抖音名字-抖音app更改名字的方法教程

抖音怎么改抖音名字1、打开抖音,点击右下角我,进入个人页面。当前版本:v36.5.0下载地址:立即下载夸克网盘下载:http://pan.quark.cn/s/31eea8de764e2、在个人页面中...

vivo在线云空间登录_vivo官方云平台入口

vivo在线云空间登录官方入口为https://yun.vivo.com.cn/,支持多端数据同步、AES-256加密安全机制、远程设备管理及智能备份策略配置。“vivo在线云空间登录 vivo官方云...

懂车帝官网网页登录_懂车帝在线电脑版官网

懂车帝官网网页登录_懂车帝在线电脑版官网

懂车帝官网网页登录入口为https://www.dongchedi.com,提供覆盖超4000款车型的参数查询、实车图集、360°环视、新能源专项数据及VIN码绑定的真实用户交互服务。懂车帝官网网页登...