[Original]dede website Modification template path tutorial, reject template leaks stolen

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

I believe that we use Dede architecture site there are a lot of it, many times we are directly copying a Templets\default folder to modify the name to achieve the purpose of modifying template path, but if you do the templates, often many places to consider

is not thoughtful, because not all functions are used. Access to some features that do not exist, 8630.html "> sometimes exposes the true path of the template."

1, Batch modification template file

method, use the batch modification tool. For example you template catalog is templets\xahot.net, then you need to bulk replace {dede:global.cfg_templets_skin/} and $cfg_templets_skin;?> for/templets/ Default or other secure path. PS, Batch modification tools online There are many, I use the Qingyun server that very good (not AD)

2, the template into the database

It is also nice to use the custom tag feature of the Dede program to prevent the template from being downloaded. Simply put the real template into the database, the HTML template is only a shell without content.

Specific steps: Enter Dede background, create a new custom tag, the tag name is Xahot. As for the content you can copy the contents of the template file. Then empty the contents of the template, write the custom tag code {Dede:mytag ismake= ' yes '/} OK, now even if the template is downloaded, the leak is just this custom tag.

3, use the site's pseudo static (URL rewrite) feature to reset the link

A, the server supports the. htaccess (Linux) file in the root directory to build a. htaccess, modified in the following way,

Like my template file in the/templest/xahot.net/directory

Now I'm going to set up a rule to display the home page content whenever I access any file in the template directory.

Change the. htaccess file:

Rewriteengine on

Rewritebase/

ErrorDocument 404/

Rewriterule Templest/xa/

Note the last rule, meaning that the contents of the home page are displayed as long as the address contains "Templets/xa".

You can see that my template directory name is not fully written, as long as it starts with XA, which protects the template and does not expose the template path.

B,iis class Web site method Httpd.ini writing (specific Httpd.ini placed not much to say, you can search under)

[Isapi_rewrite]

# 3600 = 1 hour

Cacheclockrate 3600

Repeatlimit 32

Rewriterule ^ (. *)/AA? (. +) $ $1/templest/xa$2.htm [L]

IIS can only return 404 error page, first set a 404 page, let him casually return (actual test available)

For those who like to guess the path, no matter how to guess all return a wrong page!

Summary: The first method combined with the last one is very useful and effective, modify the template is also convenient. The second type of modification is more troublesome and is not recommended for use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.