This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

✨ Vultr and Linode are back on Cloudways! VIEW PLANS→

How To Rewrite URL In Magento

Updated on December 24, 2021

7 Min Read
rewrite magento banner

The URLs which are search engine friendly tend to improve the indexing and the ranking of your Magento store. With the help of these URLs, people can find your store when they search particular keywords on any search engine. They are easier to remember and improve the navigation on your Magento store. Hence, you can’t ignore the importance of Magento URL rewrites.

When you add a product or category, the Magento system automatically generates an SEF URL based on the name or category which you have created. Also, when you add or edit the particular product or category, you can specify the URL by yourself instead of letting the Magento system do so itself. You get a built-in Magento URL rewrite manager from which you can manage the SEF URLs of the existing product and category, and you can add custom URL rewrites as well.

In this tutorial, I’ll explain the various Magento URL rewrite settings.

Install Magento in a Single Click

Simplified Magento hosting that takes away your hosting woes

Product, Category and CMS page URL Settings

When you add or edit a product or a category, you can configure a setting labeled “URL key”. This key allows you to set the URL of that particular product or that specific category freely.

Let me elaborate with an example:

When you add a product or a category by simply going to the catalog > Manage Products> Add Product button, or when you edit it by going to Catalog> Manage Products> Edit button for the particular product that you want to alter, on the general page that’s displayed by clicking on the General button on the left.

You’ll see the URL Key option:

Rewrite Custom URL Magento

If you are adding a product by just leaving the field for the URL key empty, Magento will automatically generate the URL by using the name of the product. For instance: if you add a product with name NIKE FREE RN FLYKNIT, Magento will automatically fill that blank field using URL key nike-free-rn-flyknit by just simply turning all the uppercase to lowercase letters and by separating the words with a hyphen instead of blank spaces between the words. If you type the URL yourself instead of leaving the system to do it for you, then:

  • Don’t put a slash at the beginning of the URL key because the URL key itself is a relative path that’s added to the URL base address for the store
  • use lowercase letters and separate words with hyphens.

For example, if the store is on the domain and the URL of the product is NIKE FREE RN FLYKNIT, the URL of the details page will be If you are editing the URL key of an existing product, it is recommended to leave the checkbox marked for Create Permanent Redirect for old URL. It’s just under the URL Key field.

When you add/edit categories, a same URL Key option is available. It’s on the General Information page:

URL Key Magento

The same things apply to this setting as compared to the settings done for the products.

You can set URL keys for static or CMS pages as well. You can set it by going to CMS> Pages>Add New page button, or to CMS>Pages to edit, click on the existing page listed on the table. You’ll see the option which is displayed by the Page Information button on the right:

URL key magento

Note that when you add pages, unlike products and categories, you have to type some URL in the URL Key field in order to save the page. If you leave it blank, Magento will not generate URL key automatically as it is done for category/product.

Search Engines Optimization System Setting

You can turn on and off the web server rewrites under system settings. To get this option in the admin panel, just go to System> Configuration on the page that will open, click on the Web button located on left under the General menu, and from the right side select Search Engines Optimization to expand it. This panel contains an option, Use Web Server Rewrites which is set to “No” by default:

custom url magento

You can set it to “Yes” if you want. Finally, click on the Save Config button located on the upper right corner. Note that if you don’t want to set it to “Yes”, you will still be able to set a URL Key when you add or edit products or categories.

URL Rewrite Management

The Magento admin panel has a built-in URL rewrite manager. You can edit the existing Magento URL rewrites on the admin panel. You can also add new custom rewrites, just go to Catalog > URL Rewrite Management. A page will open on which you’ll see a table listed with existing rewrites:

url rewrite management

To edit a rewrite, click on the Edit button or just on its row in the table. This will display several settings:

edit url rewrite

Most of these settings actually cannot be edited once the particular rewrite is created. Some are listed below

  • When the Type is set to System, this means the Magento URL rewrite has been automatically generated by Magento itself, which cannot be changed.
  • The actual URL path to the particular page called as Target Path can also not be
  • Request Path is the URL that is Search Engine Friendly which the customers can use to access or link to the page.

Note that people can use both the URLs to search the particular page, as mentioned in the example and both will open the same page.

The Redirect option tells us what will be shown in the address bar of the user’s browser. It’s default value is “No” . When its value is set to “No”, it means whenever the customer uses a link to access a particular page or types the SEF URL in the address bar of the browser e.g.  the SEF URL will be displayed in the address bar of the browser after the request is resolved. If you set the Redirect drop-down  to “Temporary” or “Permanent”, even when the customer types the SEF URL in the address bar , the target URL address will be shown in the address bar after the request is resolved.

To add some description or notes regarding the rewrite you can add in the text area provided for this option. This setting is called as Description. It will not affect the address or any thing on the front end of your site.

After making all the changes, don’t forget to click the Save button.

url rewrite management

At the top of the opened page there is a drop-down named Create URL Rewrite  for which you can select any of the options:

  • For Category: this option will show a list of your created categories. When you click any of the categories, some sort of settings will be displayed as displayed when editing a rewrite. You can change Request Path and Redirect setting, also you can add description.
  • For product: selecting this option will make a lists of products appear:

create url rewrite magento

Click on the product for which you want to add a rewrite. After this a list will appear with the existing category through which you can select the category to which the product belongs to. Or if you want to skip this step, just use the relative button:

add url rewrite product magento

A Magento URL rewrite is created when you add a product with respect to the base URL and with respect to the category to which the product belongs e.g: Both will open the details page of the product as mentioned above. The target path of one of these rewrites will be different. In my example, the target path for nike-free-rn-flyknit.html is catalog/product/view/id/1 and for flyknit/nike-free-rn-flyknit.html is catalog/product/view/id/1/category/1. So the explanation is that when creating a new rewrite for a product, if you select the category to which it belongs to, you’ll add an alternate request path for the target path that has the form catalog/product/view/id/1/category/1, while if you click on the Skip Category Selection button, you’ll create a rewrite/request path for the target path that has the form catalog/product/view/id/1.

For both the cases, when you click on the skip button or you select the category, a new rewrite will open the details page of the product. In any case, after clicking the button or on the category the rewrite settings will appear:

url rewrite product magento

The setting will be preconfigured with the original rewrite. To add a new rewrite just delete the old one in the field for Request Path, type the new path and then save it. Let me mention that the old rewrite will not be deleted after you have just added a new alternative path. For instance, we will change the request path to , so that when customer wants to open the page, both the links will open it. But the original target address for both is

Another thing that is worth mentioning is that rewrite/ SEF URL for products and categories is generated by the Magento System for each store view, and the generated path will be the same. For e.g if you have a multilingual store, the store view for each language will have a rewrite.

So when you want a change in SEF URL to apply to all store views, you have to rewrite for each view.


So, this article describes How To Rewrite Custom URL In Magento. I hope this article was worth reading for you. Still have any questions? Feel free to ask.
If you’d like to feel the difference a blazing fast hosting stack can have on your Magento store, launch your free trial of Cloudways fully Managed Magento Hosting today.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Abdur Rahman

Abdur Rahman is the Magento whizz at Cloudways. He is growth ambitious, and aims to learn & share information about Ecommerce & Magento Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]


Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour


  • 0


  • 0


  • 0


  • 0



For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now