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

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

如果是用于.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.jumaniu.com/14072/

本站发布的内容若侵犯到您的权益,请邮件联系 zhangqy2022#yeah.net 删除,我们将及时处理!

从您进入本站开始,已表示您已同意接受本站【免责声明】中的一切条款!

本站大部分下载资源收集于网络,不保证其完整性以及安全性,请下载后自行研究。

本站资源仅供学习和交流使用,版权归原作者所有,请在下载后24小时之内自觉删除。

若作商业用途,请购买正版,由于未及时购买和付费发生的侵权行为,使用者自行承担,概与本站无关。

常见问题
  • 本站所有资源解压密码为:www.jumaniu.com 或 www.tdji.cn
查看详情

相关文章

评论
暂无评论