40 lines
1.1 KiB
ApacheConf
40 lines
1.1 KiB
ApacheConf
# Apache 配置文件 - 用于 solarark.net 服务器
|
|
# 确保网站在 /g2026/g4/ 路径下正常工作
|
|
|
|
# 启用重写引擎
|
|
RewriteEngine On
|
|
|
|
# 设置基础目录
|
|
RewriteBase /g2026/g4/
|
|
|
|
# 如果请求的不是真实文件或目录,重定向到 index.html
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteRule ^(.*)$ index.html [L]
|
|
|
|
# 启用 Gzip 压缩
|
|
<IfModule mod_deflate.c>
|
|
AddOutputFilterByType DEFLATE text/html
|
|
AddOutputFilterByType DEFLATE text/css
|
|
AddOutputFilterByType DEFLATE application/javascript
|
|
AddOutputFilterByType DEFLATE text/javascript
|
|
AddOutputFilterByType DEFLATE application/json
|
|
</IfModule>
|
|
|
|
# 设置缓存策略
|
|
<IfModule mod_expires.c>
|
|
ExpiresActive On
|
|
ExpiresByType image/jpeg "access plus 1 year"
|
|
ExpiresByType image/png "access plus 1 year"
|
|
ExpiresByType image/gif "access plus 1 year"
|
|
ExpiresByType image/webp "access plus 1 year"
|
|
ExpiresByType text/css "access plus 1 month"
|
|
ExpiresByType application/javascript "access plus 1 month"
|
|
</IfModule>
|
|
|
|
# 防止目录浏览
|
|
Options -Indexes
|
|
|
|
# 设置默认字符集
|
|
AddDefaultCharset UTF-8
|