Skip to content

Instantly share code, notes, and snippets.

@pandanote-info
Last active September 20, 2017 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandanote-info/554ade8e0917915a62806d157336b330 to your computer and use it in GitHub Desktop.
Save pandanote-info/554ade8e0917915a62806d157336b330 to your computer and use it in GitHub Desktop.
HTTP/1.1以外のプロトコルでの接続を拒否する設定と、HTTPによるリクエストをHTTPSにリダイレクトする設定
<IfModule mod_rewrite.c>
RewriteEngine on
# HTTP/1.1以外のプロトコルでの接続を拒否する。
RewriteCond %{THE_REQUEST} HTTP/(1\.0|0\.[0-9])$
RewriteRule ^(.*)$ - [R=403,L]
# HTTPによるリクエストをHTTPSにリダイレクトする。
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment