-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.htaccess
38 lines (38 loc) · 1.2 KB
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 禁止访问敏感文件
<Files ~ "\.(tpl|cache|db|sql|log|htaccess|conf)$">
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
</Files>
<FilesMatch "(LICENSE|\.txt|\.md)$">
Header set Content-Type "text/plain; charset=UTF-8"
</FilesMatch>
# CSS默认使用utf-8编码
<FilesMatch "\.(css)$">
Header set Content-Type "text/css; charset=UTF-8"
</FilesMatch>
# JS默认使用utf-8编码
<FilesMatch "\.(js)$">
Header set Content-Type "application/javascript; charset=UTF-8"
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
Options -Indexes
DirectoryIndex index.php index.html
RewriteBase /
# 静态资源路径解析
RewriteRule ^assets/(.+)$ template/default/assets/$1 [L]
# 后台部分静态公共资源路径解析
RewriteCond %{REQUEST_URI} ^/admin/(css|images|js|tinymce)/.*$ [NC]
RewriteRule ^(admin/.+)$ template/$1 [L]
# 禁止直接访问模板文件
RewriteCond %{REQUEST_URI} ^\/template/admin/([^\/]*\.html)?$ [NC]
RewriteRule .* - [F]
# 动态请求处理
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [PT,L]
</IfModule>