up seo
This commit is contained in:
46
scripts/seo-static-generator/.htaccess
Normal file
46
scripts/seo-static-generator/.htaccess
Normal file
@@ -0,0 +1,46 @@
|
||||
# Apache .htaccess 配置 - 天远查 SPA + SEO 静态页面
|
||||
# 自动生成时间: 2026/2/25 11:04:50
|
||||
|
||||
# 启用重写引擎
|
||||
RewriteEngine On
|
||||
|
||||
# 爬虫检测
|
||||
RewriteCond %{HTTP_USER_AGENT} (googlebot|googlebot-image|googlebot-news|mediapartners-google|adsbot-google) [NC,OR]
|
||||
RewriteCond %{HTTP_USER_AGENT} (baiduspider|baiduspider-mobile) [NC,OR]
|
||||
RewriteCond %{HTTP_USER_AGENT} (bingbot|msnbot) [NC,OR]
|
||||
RewriteCond %{HTTP_USER_AGENT} "360spider" [NC,OR]
|
||||
RewriteCond %{HTTP_USER_AGENT} (sogou spider|sogou-orion) [NC,OR]
|
||||
RewriteCond %{HTTP_USER_AGENT} (spider|crawl|bot|slurp|yandex|duckduckbot|bytespider|yisouspider) [NC]
|
||||
|
||||
# 爬虫访问静态页面
|
||||
RewriteRule ^$ /static-pages/index.html [L]
|
||||
RewriteRule ^([^/]+)/?$ /static-pages/$1.html [L]
|
||||
RewriteRule ^([^/]+)/(.+)$ /static-pages/$1.html [L]
|
||||
|
||||
# 正常用户访问 SPA
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.html [L]
|
||||
|
||||
# Gzip 压缩
|
||||
<IfModule mod_deflate.c>
|
||||
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
|
||||
</IfModule>
|
||||
|
||||
# 缓存控制
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive On
|
||||
ExpiresByType image/jpg "access plus 1 year"
|
||||
ExpiresByType image/jpeg "access plus 1 year"
|
||||
ExpiresByType image/gif "access plus 1 year"
|
||||
ExpiresByType image/png "access plus 1 year"
|
||||
ExpiresByType text/css "access plus 1 month"
|
||||
ExpiresByType application/javascript "access plus 1 month"
|
||||
</IfModule>
|
||||
|
||||
# 安全头
|
||||
<IfModule mod_headers.c>
|
||||
Header set X-Frame-Options "SAMEORIGIN"
|
||||
Header set X-Content-Type-Options "nosniff"
|
||||
Header set X-XSS-Protection "1; mode=block"
|
||||
</IfModule>
|
||||
Reference in New Issue
Block a user