How to delete HTML in Magento URLs?
Magento is one of the fastest growing eCommerce platforms. There are several reasons why good web designers and eCommerce store owners prefer Magento over any other similar platforms for custom web designing and development.
Being an open-source platform, Magento is one of the most affordable options for all kinds of business websites, be it for an in-growth phase local startup or multinational companies.
Magento offers various specialised tools and features that make running an online store easier. For instance, there are inbuilt SEO and online marketing tools, international currency recognition and live currency rate updates, review and rating tools, and many more features that give the store an easy-to-use vibe for both owners and buyers.
It provides easy integration with all the major third-party sites, payment gateways and shipping services to help you run a successful eCommerce website.
Magento offers you multi-store capacity, which essentially means that you do not need to switch from panel to panel for each store. One admin panel contains all the information for all of your stores.
And lastly, it offers far broader and better customisation options. This means along with the ability to choose from in-built standard templates; you can be as creative with your store’s layout and design as you want.
Speaking of customisation, there is one issue that particularly bugs the store owners, that is, ‘How to delete HTML in Magento URLs?
You may take help from a developer, but truthfully, you do not need to be an expert to make a few simple changes. In this article, we are going to show you how you can quickly remove the .html extension and make your Magento store URLs more user and SEO friendly.
How to delete HTML in Magento URLs?
No doubt Magento is one of the best eCommerce platforms that can put you on the map right from the beginning, merely owing to its inbuilt search engine optimisation tools and features. However, when you create a store using Magento, all the URLs about it end with the .html extension.
While many store owners opt to launch their websites as such, many others look for a way to remove this extension to make their store URLs look a bit shorter and cleaner. So, the new counterpart appears as,
Avoiding the .html extension while creating the store
There is no option to prevent the .html extension while building the store itself. The reason is that the default setting in Magento is to automatically add the .html extension at the end of all the product and category URLs.
For instance, if you own a lifestyle store and you are making a page for the ‘Footwear’ category, the Magento generated URL would look like:
The same goes for the product page. So, if you have a product, say, ‘White Loafers’ under the footwear category, the Magento generated URL would look like:
Removing the .html extension from the product and category URLs of your store
The good thing, however, is that it is relatively easy to remove the .html extension with a few simple steps, and you can do it before you make your store live.
1. Log in to your Magento store’s administration panel.
2. Navigate to System > Configuration.
3. Locate the ‘Catalog’ section in the Configuration screen.
4. Go to the ‘Search Engine Optimization’ panel.
5. Remove the ‘.html.’ extensions from the ‘Category URL Suffix’ and ‘Product URL Suffix’ fields.
6. Click the ‘Save Configuration’ button.
After doing it, you will have to re-index your store to see the changes in the URL structure.
Here’s how you do it:
Navigate to System > Index Management >> Reindex All the data
Then, clear your caches, and you are done.
Removing the .html extension on the live Magento stores
Many times store owners either forget or will decide to make their stores live as created in the Magento platform, that is, with the default URLs with the .html extension. There could be numerous reasons for going this way, such as time constraints or lack of information. This situation does not mean that one has to stay stuck with these .html extensions forever.
If you decide to remove the .html extension from your store’s category and product URLs on a live Magento store, then you will have to be extra careful. What it essentially means is that you will have to make sure that your new URLs are correctly redirected to the governing page.
This can be quickly and ideally done using the HTTP 301 permanent redirect.
In case you forget to apply the HTTP 301 permanent redirect to your new URLs on the live Magento store, the URLs may appear broken, and the customers will get the ‘page not found’ message. Such cases may cause a severe blow to your search engine rankings, which will further lead to a loss of traffic to your website, which undeniably is terrible for your business.
How to properly remove the .html extension from live Magento URLs using the 301 redirect?
As explained earlier, Magento uses the default .html extension in all the store URLs. However, you can quickly remove this default HTML extension from the store URLs as explained above in the ‘How to delete HTML in Magento URLs?’ section.
But once your store is live, there are possibly hundreds, and thousands of .html URLs indexed in the search engines; there may also be several backlinks that will redirect the customers to these .html URLs. So, to avoid broken links and those irritating ‘page not found’ errors, it is essential for you to implement a global HTTP 301 permanent redirect. This way your customers won’t have to deal with the awry changes and will automatically be redirected to the original URLs counterpart without the .html extension.
So, immediately after applying the steps for removing the .html extension from the category and product fields, you must apply the following rule in your live Magento stores’ root .htaccess:
Find the RewriteBase / in your Magento .htaccess file
Add the following directory
This rule may need to be implemented differently depending upon the setup of your store and the pertaining rewrites it may have over the web.
Why remove the .html extension?
Clearly, so many store owners choose to have their stores with the .html extension, so the question persists, why remove this default .html extension in the first place?
Know the fact
Removing the .html extension as explained above does not actually ‘remove’ the extension but hides it. So, the point is while you can keep the .html extension for your store URLs, removing/hiding it has its benefits, especially for your website’s search engine optimisation.
Proof that removing the .html extension is beneficial from the SEO point of view.
Switching from www.nameofthestore.com/category.html to www.nameofthestore.com/category provides a shorter and nice looking URL, which is far better for the overall user experience.
Short and neat URLs are especially suitable for use on social media websites, such as Facebook and Twitter (since there is a certain number of characters allowed for each post).
Short URL with less number of characters helps in better optimising the store URLs with better keywords for SEO purposes, especially if the keywords are long.
For the same reasons, most of the top ranking websites on the search engines have URL links that lack the .html extension.
All the excellent SEO marketing companies also support this practice.
How to optimise the store URLs for better SEO?
Now, coming to rewriting the URLs for better SEO, the same, again, has to be done with caution. Rewriting your URLs has other benefits too; for instance, you may have misspelt a particular keyword, or maybe you want to stop offering a specific product from a category, or you want to make your URL more descriptive and accurate, or you want to move a particular product from one group to another. Whatever may be your reason, you can easily rewrite your URLs- if you choose to- after removing the .html extension and applying the global 301 permanent redirect using the following steps:
Log in to your Magento administration panel.
Navigate to the ‘Catalog’ menu and click ‘URL Rewrite Management’.
As you click on the ‘URL Rewrite Management’ option, a new screen will appear on the screen. Generally, the screen will provide all the information about the previously generated URL redirects.
Locate the ‘Add URL Rewrite’ button and click on it.
A drop-down menu will appear; choose the field for which you want to create the rewrite.
There are three options in this field: Category, Product and Custom.
Choose the ‘Custom’ field, for example.
Another screen with options will appear.
These options are
Type: It tells you the kind of field you have chosen for the URL Rewrite. You cannot change it. So, make sure you select the correct field type from the drop-down menu the first time around.
Store: Here you can choose whether the changes you are applying have to be implemented in one store or multiple stores.
ID Path: Here you type the name of your rewrite. For example, ‘301 Sample Redirect’. It is used for administrative purposes only.
Request Path: Here you mention the URL you want actually to rewrite, that is, the old URL.
Targeted Path: Here you mention the new URL that you want the old URL to be changed into.
Redirect: Here you choose whether the new redirect path will be temporary or permanent.
Description: Here you enter a small story for your chosen new URL rewrite.
Click the ‘Save’ button to save all the changes made.
Once you have saved all the changes, the old URL path will automatically be redirected to the corresponding new URL path as per your URL rewrite.
It is not a mandate that you must remove the .html extension from your Magento store URLs. However, if you want better user experience and search engine rankings, it is advisable to remove/ hide the .html extension from your store URLs.
It is needless to say that the success of your business depends on the usability and visibility across online platforms. Moreover, a few simple steps can go a long way in significantly improving the overall traffic for your website. It is understandable that it is a crucial part of developing your eCommerce website.
Point to remember:
Do not forget to apply the HTTP 301 redirect after removing the .html extension on your live Magento stores so that ‘page not found’ is never an issue.
After all, the whole point of having a correct URL is to improve the user experience.