Created
April 16, 2012 00:51
-
-
Save ariela/2395637 to your computer and use it in GitHub Desktop.
Apache用のhtaccessメモ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ファイルキャッシュ有効期限 | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType text/css "access plus 7 days" | |
ExpiresByType text/javascript "access plus 7 days" | |
ExpiresByType application/x-javascript "access plus 7 days" | |
ExpiresByType image/gif "access plus 7 days" | |
ExpiresByType image/jpg "access plus 7 days" | |
ExpiresByType image/jpeg "access plus 7 days" | |
ExpiresByType image/pjpeg "access plus 7 days" | |
ExpiresByType image/png "access plus 7 days" | |
ExpiresByType image/x-png "access plus 7 days" | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# アプリケーションの保護 | |
#RewriteRule ^(?:app|vendor)\b.* index.php/$0 [L] | |
# GZIP対応 | |
RewriteCond %{HTTP:Accept-Encoding} gzip | |
RewriteCond %{REQUEST_FILENAME} !\.gz$ | |
RewriteCond %{REQUEST_FILENAME}\.gz -s | |
RewriteRule .+ %{REQUEST_URI}.gz [L] | |
# URL書き換え | |
#RewriteCond %{REQUEST_FILENAME} !-f | |
#RewriteCond %{REQUEST_FILENAME} !-d | |
#RewriteRule .* index.php/$0 [PT] | |
</IfModule> | |
# javascript 圧縮対応 | |
<FilesMatch "\.js\.gz$"> | |
ForceType application/x-javascript | |
AddEncoding x-gzip .gz | |
</FilesMatch> | |
# css 圧縮対応 | |
<FilesMatch "\.css\.gz$"> | |
ForceType text/css | |
AddEncoding x-gzip .gz | |
</FilesMatch> | |
# 非公開ファイルのアクセス制限 | |
<Files .*> | |
Order Deny,Allow | |
Deny From All | |
</Files> | |
# IEを標準モード、Chrome Frameで | |
<IfModule mod_setenvif.c> | |
<IfModule mod_headers.c> | |
BrowserMatch MSIE ie | |
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie | |
</IfModule> | |
</IfModule> | |
# UA毎にキャッシュを変更 | |
<IfModule mod_headers.c> | |
Header append Vary User-Agent | |
</IfModule> | |
Options -Indexes | |
<IfModule mod_rewrite.c> | |
RewriteRule "(^|/)\." - [F] | |
</IfModule> | |
# php_flag register_globals Off | |
# php_value session.name sid | |
# php_flag expose_php Off | |
# php_value error_reporting -1 | |
# php_flag log_errors On | |
# php_flag display_errors Off | |
# php_flag display_startup_errors Off | |
# php_flag html_errors Off | |
# php_flag ignore_repeated_errors Off | |
# php_flag ignore_repeated_source Off | |
# php_value log_errors_max_len 1024 | |
# php_value error_prepend_string " " | |
# php_value error_append_string " " | |
<IfModule php5_module> | |
php_value session.cookie_httponly true | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment