收藏文章 楼主

伪静态 php 将 动态地址转为 html

版块:php   类型:普通   作者:小绿叶技术博客   查看:334   回复:0   获赞:0   时间:2024-07-18 16:38:02


小绿叶技术博客开启伪静态, 管理后台 > 状态页面 > 伪静态 > 开启


sudo nano bcloud_nginx_user.conf
# 在网站根目录创建下面内容的伪静态规则。

location / {
	rewrite ^/list-([0-9]+)-([0-9]+)\.html$ /index.php?c=list&sortid=$1&page=$2 last;
	rewrite ^/list-high-([0-9]+)-([0-9]+)\.html$ /index.php?c=list&type=high&sortid=$1&page=$2 last;
	rewrite ^/user-([0-9]+)\.html$ /index.php?c=user&id=$1 last;
	rewrite ^/user-([0-9]+)-([0-9]+)\.html$ /index.php?c=user&id=$1&page=$2 last;
	rewrite ^/forum-([0-9]+)\.html$ /index.php?c=forum&id=$1 last;
	rewrite ^/center-([0-9]+)\.html$ /index.php?c=center&uid=$1 last;
	rewrite ^/center-([0-9]+)-([0-9]+)\.html$ /index.php?c=center&uid=$1&page=$2 last;
	rewrite ^/read-([0-9]+)-([0-9]+)\.html$ /index.php?c=read&id=$1&page=$2 last;
	rewrite ^/app-([0-9a-zA-Z_]+)-([0-9a-zA-Z_]+)\.html$ /index.php?c=app&a=$1:$2 last;
	rewrite ^/downfile-([0-9]+)\.html$ /index.php?c=app&a=puyuetianeditor:index&s=showfile&id=$1 last;
	rewrite ^/([a-zA-Z][0-9a-zA-Z_]+)\.html$ /index.php?c=$1 last;
	rewrite ^/label-(.*)\.html$ /index.php?c=list&label=$1 last;
	rewrite ^/search-(.*)-([0-9]+)\.html$ /index.php?c=app&a=puyuetian_search&w=$1&page=$2 last;
	location ~* /logs/.*$ {
		deny all;
	}
	location ~ \.hst$ {
		deny all;
	}
}

sudo nano /datadisk/eisc/www/wwwconf/62010.www.conf
# 再 www 网站的nginx配置server模块里面引用该规则,内容如下:

include /datadisk/eisc/www/www/bcloud_nginx_user.conf;



伪静态分为两个部分:1. nginx如上规则。 2.  php 软件程序也需要配置伪静态




伪静态规则:https://www.hadsky.com/read-3967-1.html




本文章最后由 admin2024-07-23 17:38 编辑

提供企业建站服务,免费网防系统,提交信息登录 http://yundun.ddoss.cn 邮箱: proposal@ddoss.cn 
回复列表
默认   热门   正序   倒序

回复:伪静态 php 将 动态地址转为 html

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息