rewriteのアレコレ

強制的にhttpsへ飛ばす
[code]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/login/?(.*)$ https://domain.com/login/$1 [QSA,R=301]
[/code]

存在しないファイルやディレクトリは全て飛ばす
[code]
DirectoryIndex main.php index.php index.html
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ main.php
[/code]

メンテナンス画面に飛ばす
[code]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*) /maintenance.html [L]
[/code]
[code]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !maintenance.html$
RewriteRule ^(.*) /maintenance.html [L]
[/code]