网站静态页相比于动态页收录要占优势一些,但是如果网站html文件太多会导致内存过大,甚至访问变慢,所以就用到伪静态了
方法/步骤
- 
首先配置web.config文件 <rewrite> <rules configSource=”web_config\rewrite.config”/> </rewrite> 这里是改写网站里面的链接文件 
- 
然后在根目录文件下建立一个文件夹web_config, 把接下来写的改写文件(rewrite.config)放到web_config文件夹下 
- 
接下来写改写文件 
- 
<?xml version=”1.0″ ?> <rules> <rule name=”1_rewrite”> <match url=”^index.html$”/> <action type=”Rewrite” url=”index.asp”/> </rule> <rule name=”3-1_rewrite”> <match url=”^product.html$”/> <action type=”Rewrite” url=”product.asp”/> </rule> <rule name=”3-2_rewrite”> <match url=”^prolist-([0-9]*).html$”/> <action type=”Rewrite” url=”product.asp?page={R:1}”/> </rule> <rule name=”3-3_rewrite”> <match url=”^prolist-([0-9]*)-([0-9]+).html$”/> <action type=”Rewrite” url=”product.asp?cid={R:1}&sid={R:2}”/> </rule> <rule name=”3-4_rewrite”> <match url=”^proshow-([0-9]*)-([0-9]+).html$”/> <action type=”Rewrite” url=”productshow.asp?sid={R:1}&id={R:2}”/> </rule> <rule name=”4_rewrite”> <match url=”^news.html$”/> <action type=”Rewrite” url=”news.asp”/> </rule> <rule name=”4-2_rewrite”> <match url=”^newslist-([0-9]*).html$”/> <action type=”Rewrite” url=”news.asp?page={R:1}”/> </rule> <rule name=”4-5_rewrite”> <match url=”^newshow-([0-9]*).html$”/> <action type=”Rewrite” url=”newshow.asp?id={R:1}”/> </rule> </rules> 
- 
这是我的网站的rewrite.config文件,简单举例(把首页改写成伪静态页) <rule name=”1_rewrite”> <match url=”^index.html$”/> <action type=”Rewrite” url=”index.asp”/> </rule> name是命名一下这个改写链接的名称,你可以自己起 match的url就是你改写后的链接了 action的url是改写前的动态链接 
- 
这样网站的伪静态就配置完成了 
 无天博客
无天博客 扫一扫加微信
			扫一扫加微信		

最新评论
通过 systemctl 管理 firewalld 服务: # 启动防火墙 systemctl start fire
firewalld 常用命令: # 查看当前状态 firewall-cmd --state # 查看所有规则 f
转自宝塔平台,留存备用
来源通义千问
$viewrnd=rand(2,5); 这个是重点
多年前亲测有用,现在你只能网上再找找了,注意版本号
亲测无效。。
复制了两段代码后直接前后台都你的网站遇到致命错误。。。