
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_METHOD} ^TRACE|PUT|DELETE|OTIONS|CONNECT|HEAD
RewriteRule .* - [F]

RewriteCond %{HTTP_HOST} (!localhost|!www.localhost)
RewriteCond %{ENV:HTTPS} !^.*on
RewriteCond %{REQUEST_URI} admin/
RewriteRule ^(.*)$ https://%{HTTP_HOST}/admin/ [R=301,L]

RewriteCond %{HTTP_HOST} (localhost|www.localhost)
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} admin/
RewriteRule ^(.*)$ https://%{HTTP_HOST}/admin/ [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

