Change of Magento contacts page URL

Change of Magento contacts page URL

October 3, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Change of Magento contacts page URL

Changing Magento Contact Page URL: A Step-by-Step Guide

Are you looking to change your Magento contact page URL from /contacts to contact-us.html? You’ve come to the right place! In this guide, we’ll walk through the process step by step.

Understanding the Problem

By default, when you install a fresh Magento instance, the contacts page is set up with the URL pattern /contacts. While this works fine for many stores, some merchants prefer a more SEO-friendly or branded URL structure like contact-us.html.

The issue lies in how Magento handles core router configuration and routing rules. The built-in contact module has specific rules defined that direct traffic to the default /contacts endpoint.

A Brief Overview of Magento Routing

Before we dive into the solution, let’s quickly recap how Magento routing works:

  1. Router: Magento uses a multi-level router system that matches request URLs against configuration files. The core router first matches URLs against the config.xml file for each module.

  2. FrontController: Once matched, control is passed to the appropriate front controller (like Mage_Core_Controller_Varien_Router_Abs or Mage_Cms_Helper_Router).

  3. Routing Rules: Each front controller has its own set of routing rules defined in the config.xml. These rules determine which controllers handle which URLs.

Changing the Contact Page URL

Now that we have a basic understanding of Magento’s routing system, let’s change our contact page URL:

  1. Open your terminal and navigate to your Magento root directory.

  2. Create a new file named frontend/cms/url/rewrite_contacts.xml in the app/code/core/Mage/Cms/etc/ folder. This is where we’ll define our custom rewrite rules.

  3. Add the following XML code to the newly created file:

<urlrewrites>
    <rewrite><id>contacts</id><entity_model_path>cms/page/view</entity_model_path><target_path>contact-us.html</target_path><is_system>1</is_system></rewrite>
</urlrewrites>

Here’s what each element does:

  • <id>: contacts - The internal ID of the rewrite rule.
  • <entity_model_path>: cms/page/view - The path to the page model that we’re rewriting.
  • <target_path>: contact-us.html - The new URL we want to use for our contact page.
  • <is_system>: 1 - Flag indicating this is a system-wide rewrite.
  1. Save and close the file.

  2. Clear your Magento cache by running the following command:

php bin/magento cache:clean

Verifying the Change

To ensure the change took effect, do the following:

  1. Open your browser and navigate to http://localhost/contact-us.html.

  2. Check if the contact page loads successfully. If everything is set up correctly, you should see your contact page displayed at this new URL.

  3. Test form submission by filling out the form and clicking “Submit”. The form should still function as intended, but now it uses your custom contact-us.html URL pattern.

Troubleshooting Common Issues

If you encounter any issues during this process, consider the following:

  • Make sure you’re working in the correct directory (the Magento root, not a subdirectory).
  • Ensure there are no typos or syntax errors in your XML file.
  • Check that your Magento installation is up-to-date and that all required permissions are set correctly.

Using Laravel for Advanced Routing

While this guide focuses on Magento’s built-in routing system, it’s important to note that advanced customizations may require a more robust solution, such as using PHP frameworks like Laravel. At LaravelCompany.com, we specialize in creating scalable and secure web applications using Laravel.

For instance, if you’re looking to create a highly customized contact form with complex backend functionality, a dedicated Laravel application might be the optimal choice. Laravel’s routing system is more flexible than Magento’s built-in configuration, allowing for greater control over URL patterns.

Conclusion

Changing your Magento contact page URL from /contacts to contact-us.html requires a basic understanding of how Magento handles routes and URLs. By creating a custom rewrite rule in the app/code/core/Mage/Cms/etc/ directory, we can easily redirect traffic to our desired URL without affecting the core functionality.

Remember, when dealing with Magento’s routing system, it’s crucial to carefully manage your changes to avoid conflicts or unexpected behaviors. If you find yourself needing more advanced routing capabilities, consider exploring Laravel as a potential solution for your projects.

That concludes our guide on changing Magento contact page URLs. Happy coding!

Extensions Configuration SEO Errors

Our network