Search code examples
apachelocalhostmampvirtualhostmacos-high-sierra

MAMP on Mac redirects virtual localhost to https


Chrome Version : 67.0.3396.87

Webserver : Apache

When I hit http://www.assignmenthelpdesk.local , it redirects to https://www.assignmenthelpdesk.local/

How can I stop MAMP to redirect to https? Thanks in advance.

/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf details below:

<VirtualHost *:80>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /Applications/MAMP/htdocs/AssignmentHelpDesk
    ServerName www.assignmenthelpdesk.local
</VirtualHost>

/etc/hosts details

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
127.0.0.1       www.assignmenthelpdesk.local
255.255.255.255 broadcasthost
::1             localhost

/Applications/MAMP/conf/apache/httpd.conf details below:

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

Solution

  • Everything is working now.

    I just had to remove the below two lines from .htaccess for assignmenthelpdesk (local folder)

    RewriteCond %{HTTPS} off

    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]