phpmywind程序在宝塔面板上怎么做伪静态

phpmywind程序在宝塔面板上怎么做伪静态

一、登入网站后台开启伪静态

phpmywind程序在宝塔面板上怎么做伪静态

二、宝塔apache环境 伪静态规则

复制规则粘贴到记事本,保存为.htaccess文件,存放在在根目录即可

phpmywind程序在宝塔面板上怎么做伪静态

# 将 RewriteEngine 模式打开
RewriteEngine On

# 修改以下语句中的 / 改为您的系统目录地址,如果程序放在根目录中则无需修改(宝塔环境默认就行)
RewriteBase /

# Rewrite 系统规则请勿修改
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^index.html$ index.php
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^about-([0-9]+)-([0-9]+)\.html$ about.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^news-([0-9]+)-([0-9]+)\.html$ news.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^newsshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ newsshow.php?cid=$1&id=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^product-([0-9]+)-([0-9]+)\.html$ product.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^productshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ productshow.php?cid=$1&id=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^case-([0-9]+)-([0-9]+)\.html$ case.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^caseshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ caseshow.php?cid=$1&id=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^join-([0-9]+)\.html$ join.php?page=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^joinshow-([0-9]+)\.html$ joinshow.php?id=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^message-([0-9]+)\.html$ message.php?page=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^contact-([0-9]+)-([0-9]+)\.html$ contact.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^soft-([0-9]+)-([0-9]+)\.html$ soft.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^softshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ softshow.php?cid=$1&id=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^goods-([0-9]+)-([0-9]+)-([0-9]+)\.html$ goods.php?cid=$1&tid=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^goodsshow-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ goodsshow.php?cid=$1&tid=$2&id=$3&page=$4
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^vote-([0-9]+)\.html$ vote.php?id=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(\w+)\.html$ $1.php?

三、宝塔Nginx环境 伪静态规则

复制规则粘贴到nginx.conf或虚拟主机段的根目录

rewrite ^([^\.]*)/index.html$ $1/index.php last;
rewrite ^([^\.]*)/about-([0-9]+)-([0-9]+)\.html$ $1/about.php?cid=$2&page=$3 last;
rewrite ^([^\.]*)/news-([0-9]+)-([0-9]+)\.html$ $1/news.php?cid=$2&page=$3 last;
rewrite ^([^\.]*)/newsshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/newsshow.php?cid=$2&id=$3&page=$4 last;
rewrite ^([^\.]*)/product-([0-9]+)-([0-9]+)\.html$ $1/product.php?cid=$2&page=$3 last;
rewrite ^([^\.]*)/productshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/productshow.php?cid=$2&id=$3&page=$4 last;
rewrite ^([^\.]*)/case-([0-9]+)-([0-9]+)\.html$ $1/case.php?cid=$2&page=$3 last;
rewrite ^([^\.]*)/join-([0-9]+)\.html$ $1/join.php?page=$2 last;
rewrite ^([^\.]*)/joinshow-([0-9]+)\.html$ $1/joinshow.php?id=$2 last;
rewrite ^([^\.]*)/message-([0-9]+)\.html$ $1/message.php?page=$2 last;
rewrite ^([^\.]*)/contact-([0-9]+)-([0-9]+)\.html$ $1/contact.php?cid=$2&page=$3 last;
rewrite ^([^\.]*)/soft-([0-9]+)-([0-9]+)\.html$ $1/soft.php?cid=$2&page=$3 last;
rewrite ^([^\.]*)/softshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/softshow.php?cid=$2&id=$3&page=$4 last;
rewrite ^([^\.]*)/goods-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/goods.php?cid=$2&tid=$3&page=$4 last;
rewrite ^([^\.]*)/goodsshow-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/goodsshow.php?cid=$2&tid=$3&id=$4&page=$5 last;
rewrite ^([^\.]*)/vote-([0-9]+)\.html$ $1/vote.php?id=$2 last;
rewrite ^([^\.]*)/(\w+)\.html$ $1/$2.php? last;
if (!-e $request_filename) {
    return 404;
}

更多规则请访问自己网站后台

原创文章,作者:admin,如若转载,请注明出处:https://www.ziyuanzhan.com.cn/2020/04/25/doc-516.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注

联系我们

400-800-8888

在线咨询:点击这里给我发消息

邮件:trcsj@qq.com

工作时间:周一至周五,9:30-17:30,节假日休息