Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

How to get MAMP to read .htaccess files

Writer Emily Wong

I am trying to get the .htaccess working in MAMP. The content of the .htaccess is a simple redirect line, but the entire .htaccess file seems to have no effect, even when I change it to contain invalid data.

Is there any settings within MAMP I need to change to enable .htaccess files?

0

6 Answers

  1. In httpd.conf on /Applications/MAMP/conf/apache, find:

    <Directory /> Options Indexes FollowSymLinks AllowOverride None
    </Directory>
  2. Replace None with All.

  3. Restart MAMP servers.

6

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>

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

1

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.

1

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.

2

I have MAMP v 6.6.2 (year 2022), and I was trying to make working php friendly URLs on my localhost Apache, by adding '.htaccess' file to my website root directory ("localhost/mywebsite/.htaccess"):

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?id=$1 [L,QSA] 

Which didn't work. But I tested it on cPanel hosting on a real domain and it worked fine.

So I have tried to change httpd.conf with these advises:

  1. - didn't help
  2. - didn't help
  3. - didn't help

In the end I came up to an advise:

  • - and it worked!

I simply commented out the second line of the code in my '.htaccess' (located at "localhost/mywebsite/.htaccess") file and that's it:

RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?id=$1 [L,QSA] 

After it started to work I reverted all the changes in httpd.conf file, I have done above, and it was still working.