杰奇通过伪静态防止模板被盗

本文阅读 2 分钟
广告

似乎很多网上的模板都已经自带了伪静态配置文件,也写了相关的规则,但是问题在于如果是自己开发模板,就显得比较烦了,访问者通过浏览就可以随意进入模板目录,然后将所有的代码都复制下来,这就比较尴尬了。所以可以通过简单的方法,让盗模板的人,转移到错误的页面。

如果是用于.htaccess文件
对于杰奇1.7版本,写法如下:

RewriteRule ^modules/article/templates/$ 404.html
RewriteRule ^templates/(.*).html$ 404.html
RewriteRule ^themes/自定义模板/(.*).html$ 404.html
RewriteRule ^自定义路径/(.*).html$ 404.html

对于1.8及2.2版本,写法如下:

RewriteRule ^modules/article/templates/$ 404.html
RewriteRule ^modules/article/templates/blocks/$ 404.html
RewriteRule ^templates/(.*).html$ 404.html
RewriteRule ^themes/自定义模板/(.*).html$ 404.html
RewriteRule ^自定义首页路径/(.*).html$ 404.html

如果是用于httpd.ini文件
对于杰奇1.7版本,写法如下:

RewriteRule ^(.*)/自定义首页路径/(.*)\.html$ $1/404\.html
RewriteRule ^(.*)/templates/(.*)\.html$ $1/404\.html
RewriteRule ^(.*)/themes/自定义模板路径/(.*)\.html$ $1/404\.html
RewriteRule ^(.*)/modules/article/templates/$ $1/404\.html
RewriteRule ^(.*)/modules/article/templates/(.*)\.html$ $1/404\.html

对于1.8及2.2版本,写法如下:

RewriteRule ^(.*)/自定义首页路径/(.*)\.html$ $1/404\.html
RewriteRule ^(.*)/templates/(.*)\.html$ $1/404\.html
RewriteRule ^(.*)/themes/自定义模板路径/(.*)\.html$ $1/404\.html
RewriteRule ^(.*)/modules/article/templates/$ $1/404\.html
RewriteRule ^(.*)/modules/article/templates/(.*)\.html$ $1/404\.html
RewriteRule ^(.*)/modules/article/templates/blocks/(.*)\.html$ $1/404\.html

1.8及2.2版本增加了区块调用模式,也就是大部分的数据调用代码不是写在模板文件,而是区块中的blocks定义文件里面,这种模式一定程度上防止盗取,但是终究也是有限的,以上就是伪静态写法。

规则之树版权所有,转载注明来源

本文来自投稿,不代表本站立场,如若转载,请注明出处:https://www.ruletree.club/archives/177/
杰奇1.8最新版,使用体验付下载
« 上一篇 09-22
织梦小说模块,下载及安装教程
下一篇 » 09-24
广告

发表评论

成为第一个评论的人

作者信息

热门文章

标签TAG

热评文章