Broken Images and subpages on Mamp (mod_rewrite was disabled)

After doing a clean install of the starterkit:
git clone https://github.com/getkirby/starterkit.git
I pointed Mamp (not Mamp pro) to that folder. My version of Mamp (v7) is running PHP8.3.8.

The homepage loaded but all the images were broken and none of the subpages would load.
I first made sure my .htacces file was in place but that wasn’t the issue.

After some digging, I realized that this version of Mamp seems to have mod_rewrite disabled by default.

This was a big problem but easily fixed.

Here’s how to enable mod_rewrite in MAMP:

  1. Stop MAMP servers: First, make sure to stop the MAMP servers if they’re running.
  2. Locate the Apache configuration file: The file you need to edit is typically located at: /Applications/MAMP/conf/apache/httpd.conf
  3. Edit the httpd.conf file: Open this file with a text editor. You might need administrator privileges to edit it.
  4. Find the mod_rewrite line: Look for a line that looks like this: #LoadModule rewrite_module modules/mod_rewrite.so
  5. Uncomment the line: Remove the # at the beginning of the line, so it looks like this: LoadModule rewrite_module modules/mod_rewrite.so
  6. Save the file: Save your changes and close the text editor.
  7. Restart MAMP: Start the MAMP servers again.

Posting this just in case it helps anyone with the same problem!

3 Likes

Ian! You’re a legend, this was driving me nuts. This fix worked great, the folks developing Kirby should consider adding this to the official docs.

1 Like

Glad it helped! Definitely would have saved me some time if there was something more explicit about this written somewhere. I know mod_rewrite is a requirement but it being off by default in MAMP is news to me and was never something I had to consider before now.

2 Likes

I just had to sign up to this forum to thank you for this marvelous find. I had to setup a new laptop so had a fresh install of MAMP. I would never have thought of this function being turned off by default after all these years. Thank you Ian!

1 Like

Same for me, was setting things set up on a new laptop and could not figure out why it was failing so badly. Especially because it seemed like the exact same setup that had been working for years.

@lukasbestle is this documented anywhere officially?

No, not sure where to best add this as it is dev environment related. Maybe in troubleshooting guide?

Maybe in the quick start guide?

I thought there were some guides on getting up and running locally with MAMP but that may have been a long time ago.

Yes, those do not exist anymore, because this sort of stuff gets outdated too quickly, and we cannot keep track of changes to 3rd party software.

That’s why this particular thing doesn’t make sense in the quick start guide either, in my opinion, as it only relates to this specific environment.

I have no idea why MAMP made such a silly change in the first place, pretty annoying.

We already have a section here: