MAMP is installed in a MacBook. I use the MAMP apache.
Based on many online resources, I have done the following:
I added 127.0.0.1 my-site.local
to file /etc/host
.
I uncommented Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
in /Applications/MAMP/conf/apache/httpd.conf
.
In /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
, I added
<VirtualHost *:80>
DocumentRoot "/Users/myname/laravel/mysite/public"
ServerName my-site.local
ServerAlias my-site.local
<Directory "/Users/myname/laravel/mysite/public">
DirectoryIndex index.php
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
In /Users/myname/laravel/mysite/.htaccess
file:
<IfModule mod_rewrite.c>
Options +Indexes +FollowSymLinks +MultiViews
RewriteEngine On
#RewriteBase /
# Redirect Trailing Slashes If Not A Folder...
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Require all granted
</IfModule>
After all, localhost
, localhost/MAMP
, localhost/phpMyAdmin
, all work, EXCEPT for my-site.local
.
It shows 500 Internal server error. The server encountered an internal error or misconfiguration and was unable to complete your request.
Problem Solved!
Because the apache has been updated to apache2.2,
in the Applications/MAMP/conf/apache/extra/httpd-vhosts.conf,
change Require all granted
to Satisfy Any
.
That is it!
It took me two days to figure it out~