The requested URL was not found on this server. .htaccess (MAMP)

The requested URL was not found on this server. .htaccess (MAMP)

July 12, 2026 · Illustrated author avatarBy Stefan Bogdanescu
The requested URL was not found on this server. .htaccess (MAMP)

Migrating Magento Sites: Resolving “URL Not Found” Errors on MAMP

As an experienced e-commerce developer working with Magento sites, I often encounter issues when migrating projects between different environments. One common problem is the dreaded “Not Found. The requested URL was not found on this server” error that occurs after moving a site from a live server back to your local development environment (MAMP). Let’s dive into understanding and resolving this issue.

Identifying the Root Cause

When you encounter this error, it typically stems from changes made to your .htaccess file or the Apache configuration during your time on the live server. You mentioned that your hosts updated your PHP version after receiving a “new PHP is available” message in your Magento backend. While it’s commendable that you tried to keep your site secure by updating PHP, this action likely caused the initial problems.

The Role of the .htaccess File

The .htaccess file plays a crucial role in configuring how your server handles URLs and rewrites them to point to the appropriate resources or scripts within your application. You noticed that the .htaccess files for working pages open directly in the terminal window, while the problematic ones open in a text editor. This difference suggests that there’s an issue with the rewrite rules specified in the non-functioning .htaccess file.

Reviewing the Provided Solution

Your host provided a solution to fix internal redirects by adding a specific code snippet to the root directory of your live server (/home/caprac5/public_html/.htaccess). Let me break down what this code does:

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

The key points here are:

  • RewriteEngine On: Enables the rewrite engine, allowing Apache to process rewrite rules.
  • RewriteBase /: Sets the base path for relative paths used in subsequent rules.
  • The first two RewriteCond lines ensure that this rule only applies if the requested URI does not correspond to a directory or actual file on the server.
  • The final RewriteRule statement rewrites all incoming requests to point to the index.php script, passing along the original request URI as a parameter ( grâce à [QSA,L]).

Potential Solutions for Your MAMP Environment

Given that your live environment likely has this .htaccess rule active but your local MAMP setup doesn’t, you have two main options:

  1. Add the Provided .htaccess File to Your MAMP Root Directory

    You can create a new .htaccess file in the root directory of your MAMP installation (usually found at /Applications/MAMP/htdocs/) and add the provided rewrite rules. This approach mimics the configuration on your live server, ensuring that incoming requests are correctly handled by Magento.

  2. Update Your Magento .htaccess File

    If you prefer to keep your project structure clean and avoid modifying the MAMP root directory, you can update the existing .htaccess file within your Magento installation folder. In this case, ensure that the file has proper read and write permissions (755 or 644) for Apache to process the rewrite rules.

A Step-by-Step Guide

To resolve the issue:

  1. Access Your MAMP Installation

    Open your terminal and navigate to the appropriate folder containing your Magento installation on MAMP. You can use commands like cd to change directories or pwd to verify your current location.

  2. Copy the Provided .htaccess File

    Use a command such as cp /Applications/MAMP/htdocs/.htaccess ~/ to create a backup copy of the default MAMP .htaccess file in your home directory for safekeeping.

  3. Create or Update Your Magento .htaccess File

    Create a new file named .htaccess within your Magento installation folder, or modify the existing one if it already exists but is empty or contains only comments. Add the provided rewrite rules to this file:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
  1. Save and Close the File

    Press Ctrl+X to exit the editor, then type Y to confirm that you want to save changes and press Enter. Make sure the file has proper permissions by using the chmod 644 /path/to/your/magento/.htaccess command if needed.

Conclusion

When migrating Magento sites between environments, always be cautious when updating PHP versions or server configurations. Ensure that any changes made on your live server are properly documented and understood before moving your site back to a local development environment like MAMP.

By following the steps outlined above—either adding the provided .htaccess file to your MAMP root directory or updating the one within your Magento installation folder—you should be able to resolve the “URL Not Found” errors and restore proper functionality to your project on MAMP.

Remember that working with rewrite rules requires a solid understanding of how Apache processes incoming requests. If you’re unsure about any aspect of this process, don’t hesitate to consult trusted resources like the official Magento documentation or seek guidance from experienced developers in the community.

Happy developing!

Admin Configuration Errors

Our network