MAMP redirect to SSL

If part of your daily work is working on SSL websites then tools like MAMP are quite useful. However it's easy to forget to add https:// when you'd rather just type the hostname. By Adding a snippet to the default virtual host that can still be easy:

RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

Note, however, that you may mask some bugs where your local development server silently redirects to the SSL server where the production server would fail to do so.

Category: