How to get htaccess to work on MAMP
.HtaccessMamp.Htaccess Problem Overview
I am trying to get the .htaccess
working in MAMP.
The content of the .htaccess
is a simple redirect line but it does not work. I am trying to manipulate URLs of a WordPress page, so I added the .htaccess
file in my theme folder, but it is not working.
Is there any settings within MAMP i need to change to get the .htaccess
file to work?
.Htaccess Solutions
Solution 1 - .Htaccess
-
In
httpd.conf
on/Applications/MAMP/conf/apache
, find:<Directory /> Options Indexes FollowSymLinks AllowOverride None </Directory>
-
Replace
None
withAll
. -
Restart MAMP servers.
Solution 2 - .Htaccess
Go to httpd.conf
on /Applications/MAMP/conf/apache
and see if the LoadModule rewrite_module modules/mod_rewrite.so
line is un-commented (without the # at the beginning)
and change these from ...
<VirtualHost *:80>
ServerName ...
DocumentRoot /....
</VirtualHost>
To this:
<VirtualHost *:80>
ServerAdmin ...
ServerName ...
DocumentRoot ...
<Directory ...>
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory ...>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Solution 3 - .Htaccess
I'm using MAMP (downloaded today) and had this problem also. The issue is with this version of the MAMP stack's default httpd.conf directive around line 370. Look at httpd.conf down at around line 370 and you will find:
<Directory "/Applications/MAMP/bin/mamp">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
You need to change: AllowOverride None To: AllowOverride All
Solution 4 - .Htaccess
If you have MAMP PRO you can set up a host like mysite.local, then add some options from the 'Advanced' panel in the main window. Just switch on the options 'Indexes' and 'MultiViews'. 'Includes' and 'FollowSymLinks' should already be checked.
Solution 5 - .Htaccess
The problem I was having with the rewrite is that some .htaccess files for Codeigniter, etc come with
RewriteBase /
Which doesn't seem to work in MAMP...at least for me.