Hostker 主机的优化配置

提纲
  1. 1. 没有 HTTPS 如何装逼。。。
  2. 2. .htaccess 配置文件:

有点贝壳,捣腾了几天 Hostker 玩,,,哈哈哈

写个 .htaccess 来强制 HTTPS 跳转了

没有 HTTPS 如何装逼。。。HTTPS

.htaccess 配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
### 我的 Hostker 主机 .htaccess 配置
## 启用地址重写模块
RewriteEngine On
# 针对 Hostker 主机的 SSL 监听方案
RewriteCond %{HTTP:KERSSL} !on
# 全局 HTTPS 并强制跳转带 www. 域名模式
RewriteRule .* https://www.gehaowu.com/$1 [R=301,L]
## 设置出错页面
# 设置404 页
ErrorDocument 404 /404.html
## 设置缓存策略
# 启用缓存功能
ExpiresActive On
# 默认全局缓存时间为3天
ExpiresDefault "access plus 3 days"
# 指定文件缓存5天
<FilesMatch "\.(css|gif|jpeg|jpg|js|png|ico|bmp|svg|doc|pdf|mp3|ogg|mp4|mpeg|webm|eot|ttf|woff)$">
ExpiresDefault "access plus 5 days"
</FilesMatch>
# 指定文本文件缓存1天
<FilesMatch "\.(htm|html|xhtml|shtml|xml|rss|atom|txt)$">
ExpiresDefault "access plus 1 days"
</FilesMatch

参考:博客启用SSL访问数据更安全