dedecms禁止用户访问htm文件模板

如何不如用户在浏览器端访问网站模板目录?辛辛苦苦的做个网站,可以在源码查看到模板路径,在不改模板路径的情况下,通过伪静态设置,即可防止用户查看到网站模板。

这里是禁止访问htm文件。

1、Apache环境可以设置禁止用户访问该文件夹或目录执行权限:

RewriteEngine On
RewriteRule templets/(.*).(htm)$ – [F]
RewriteRule data/(.*).(htm)$ – [F]
RewriteRule include/(.*).(htm)$ – [F]

 

2、Nginx环境:

location ~ templets/(.*).(htm)$ {
  return 403;
}
location ~ data/(.*).(htm)$ {
  return 403;
}
location ~ include/(.*).(htm)$ {
  return 403;
}

 

设置好后,打开htm文件即可显示403错误

posted @ 2019-09-09 14:37  紫云传芳  阅读(226)  评论(0)    收藏  举报