My .htaccess redirect config:
Code: Select all
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
First, I checked MAMP PRO -> Hosts -> SSL and ensured Allow to access this host via insecure http connections was enabled.
Then, I opened MAMP Pro -> Ports and User and discovered Apache non-SSL connections for MAMP Pro was running on port 81 instead of 80! I had MAMP Pro to always use port 80.
I coordinated the timing of the redirects not working after I performed a macOS system update. Sure enough, I discovered the macOS update re-enabled the default macOS Apache server on port 80 forcing MAMP Pro to use the next available port, 81.
The solution was simple - disable the default macOS Apache server so MAMP Pro Apache can run on port 80 again.
Make sure to stop MAMP Pro Apache before proceeding!
1. Open macOS Terminal and type:
Code: Select all
sudo apachectl stop
2. Ensure the default version of Apache is stopped by browsing to http://localhost:80/. The page should not load.
3. In order to disable the default macOS Apache server on future reboots, type the following command:
Code: Select all
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
4. In MAMP Pro, go to Ports and User and change back the Apache non-SSL port to 80.
5. Start Apache for MAMP Pro.
Test your http to https redirects again - you should be set!
Takeaway: ensure the default macOS Apache server is not running after a macOS system update. You can check this by browsing to http://localhost:80/ when MAMP Pro Apache is not running.