MLECMS 提供了两种类型的伪静态方式 Apache 和 Nginx,首先确定您的平台类型,以下均以MLECMS专用主机为例:
一、Apache伪静态规则:
RewriteEngine On
RewriteBase /
ErrorDocument 404 /404.html
RewriteRule ^(article|product|photo|download|cart|tag|guestbook|feedback|search|app)\.html$ $1.php RewriteRule ^(article|product|photo|download)-([0-9]+)-([0-9]+)\.html$ $1.php?pid=$2&page=$3
RewriteRule ^(article|product|photo|download)-([0-9]+)\.html$ $1.php?pid=$2
RewriteRule ^(article|product|photo|download)--([0-9]+)\.html$ $1.php?page=$2
RewriteRule ^(list|category|slide|soft)-([0-9]+)-([0-9]+)\.html$ $1.php?cid=$2&page=$3
RewriteRule ^(list|category|slide|soft)-([0-9]+)\.html$ $1.php?cid=$2
RewriteRule ^(view|detail|show|down)-([0-9]+)-([0-9]+)\.html$ $1.php?id=$2&page=$3
RewriteRule ^(view|detail|show|down)-([0-9]+)\.html$ $1.php?id=$2
RewriteRule ^member\/(.*)\.html$ member/$1.php
Apache设置伪静态方便简单,只要您的主机支持Apache伪静态,进入MLECMS后台 - 系统全局参数设置 - 静态方式(选择伪静态即可)。系统会在网站根目录下自动创建 .htaccess 静态规则文件,当你关闭伪静态功能时系统会尝试删除该文件。RewriteBase /
ErrorDocument 404 /404.html
RewriteRule ^(article|product|photo|download|cart|tag|guestbook|feedback|search|app)\.html$ $1.php RewriteRule ^(article|product|photo|download)-([0-9]+)-([0-9]+)\.html$ $1.php?pid=$2&page=$3
RewriteRule ^(article|product|photo|download)-([0-9]+)\.html$ $1.php?pid=$2
RewriteRule ^(article|product|photo|download)--([0-9]+)\.html$ $1.php?page=$2
RewriteRule ^(list|category|slide|soft)-([0-9]+)-([0-9]+)\.html$ $1.php?cid=$2&page=$3
RewriteRule ^(list|category|slide|soft)-([0-9]+)\.html$ $1.php?cid=$2
RewriteRule ^(view|detail|show|down)-([0-9]+)-([0-9]+)\.html$ $1.php?id=$2&page=$3
RewriteRule ^(view|detail|show|down)-([0-9]+)\.html$ $1.php?id=$2
RewriteRule ^member\/(.*)\.html$ member/$1.php
注:如果有必要修改规则,请勿使用记事本直接编辑 .htaccess 文件,必须使用可以去掉 Unicode 签名(BOM)的工具进行编辑。关于BOM