How to create SEO-friendly URLs in Magento 2
|

How to create SEO-friendly URLs in Magento 2

One of the biggest questions if you are running an e-commerce business on Magento 2 platform, will be how to create SEO-friendly URLs.

In this blog post, I will try to explain and share some good tactics for SEO-Friendly URLs in Magento 2, as one of the top e-commerce platforms worldwide.

First, before we dive deeper make sure you checked the basics of how to create SEO-Friendly URLs.

By default, Magento 2 similar to the previous version of Magento 1 is not well SEO optimized in terms of URL structure.

Of course, the friendliness of the URLs will mostly depend on your website structure, but here are the things you cannot avoid and must be done before that.

1.Check if website is enabled for crawling

Under Content -> Design(Configuration) -> Edit -> Search Engine Robots. The default robots settings should be INDEX, FOLLOWso most of the crawlers can access and crawl your website URLs.

Any other settings can lead to a huge SEO problem. Example if crawler is not allowed to index the website you will never find it on the search engines no matter what.

2.Redirects & Rewrites

Enable system rewrites so later Magento can permanently redirect the old URLs to the new one if you change anything in the URL key.

1. Stores>Configuration> Web
2. expand the Search Engine Optimization section
3. set Use Web Server Rewrites to “Yes.”
4. When complete, tap Save Config

After that the Step 1. is done.

The main issue why we do that is to remove the index.php identifier from all Magento 2 URLs so we can prevent duplicates.

Then in your .htaccess file, you need to add the following code:

    RewriteEngine on    
     RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
     RewriteCond %{REQUEST_URI} !/system/.* [NC]
     RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

3. Magento 2 URL settings

Go to Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization tab.

Personally i prefer the following settings:

Search Engine Optimization Settings Magento 2
Search Engine Optimization Settings Magento 2

First of all .html extension is useless in Magento 2 URLs and I don’t even know, why they still keep it as a feature.

http:www/yourwebsite.com/category.html -> http:www/yourwebsite.com/category
http:www/yourwebsite.com/producturl.html -> http:www/yourwebsite.com/producturl

Canonical links are no by default so please make sure you switch them on. They are really important to prevent duplicate content because are helping search engines to understand that similar representation of the same web page is actually the same URL.

Use Categories Path for Product URLs (NO) – I prefer to keep my product URLs shorter.

But keep in mind, that depends on the website structure.

If you have descriptive product URLs, that are your main SEO power, keep the setting as No.

On the other side if your categories are describing the product itself make sure to enable the setting.

You will need to reindex and refresh caches after the changes.

Please post question in comments if you have some.

Want to learn more about Magento 2 SEO?

SEO enthusiast and PHP Web Developer. I love the tech and marketing world. Also, a part-time traveler who enjoys nature.

Spread the love

Similar Posts

Leave a Reply