Magento not using appropriate URL - 404 Page not found

Magento not using appropriate URL - 404 Page not found

October 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento not using appropriate URL - 404 Page not found

Magento URL Not Working Properly: A Comprehensive Guide

Hello everyone! Today we’re going to solve a common issue faced by many Magento developers - a 404 “Page not found” error when clicking on category links.

The Problem

You’ve set up two Magento sites locally using WAMP - one is working perfectly, but the other gives you a 404 error whenever you click on any category or subcategory. You notice that the generated URL for these categories is missing the “index.php” part, and adding it manually makes them work.

Why Does This Happen?

The issue lies in how Magento handles URLs. By default, it expects the index.php file to be present in the URL structure. When you click on a category link, if the URL doesn’t include index.php, Magento can’t find the correct route to render the page content.

In your case, since one site is working and the other isn’t, there could be a few reasons:

  1. Different versions of PHP or webserver configurations between the two sites.
  2. Different .htaccess files being used.
  3. Incorrect rewrite rules in the .htaccess file for the second site.

How to Fix It

Let’s go through a step-by-step guide to resolve this issue:

Step 1: Check Your Base URL

First, ensure that your Base URLs are correctly set up under System > Configuration > General > Web. They should look something like this:

Step 2: Verify Your .htaccess File

Open your .htaccess file located in the root directory of your Magento installation.

Check if it contains these lines near the top:

RewriteEngine On
RewriteBase /newsite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

If the “RewriteBase” line is missing or has a different path, update it to match your URL structure.

Step 3: Enable Apache Rewrite Mod

Ensure that you have enabled the Apache rewrite module on your WAMP server. You can do this by:

  1. Running XAMPP Control Panel.
  2. Clicking on “Modules”.
  3. Checking the box next to “Rewrite_module” under the “Apache Modules” section.

Step 4: Check Your Database

Ensure that your database is configured correctly and all tables are created properly during installation. You can verify this by running a SELECT query on phpmyadmin for your new database.

Step 5: Re-index All Data

Sometimes, Magento’s index management can get out of sync. To fix this:

  1. Go to System > Index Management.
  2. Select “Reindex all” from the dropdown menu and click “Submit”.

Conclusion

Remember, URL handling in Magento is a critical aspect that often gets overlooked or misconfigured. Always ensure your .htaccess file is properly set up with the correct RewriteBase directive.

If you’re still facing issues after following these steps, it might be due to more complex server configurations or compatibility issues between different versions of PHP and Magento.

For detailed guides on Magento installations, URL handling best practices, and how to optimize your e-commerce site’s performance, check out our comprehensive resources at Laravel Company.

Don’t hesitate to reach out if you have any further questions or need personalized assistance with your Magento setup. Happy coding!

Catalog Configuration Errors CLI

Our network