Magento’s rewrite functionality is definitely not the easiest thing to get your head around (especially as an SEO) and it’s caused me countless issues over the last few years, primarily from an SEO perspective. I’ve written this article to help merchants understand and resolve SEO issues caused by Magento’s URL rewriting functionality.
Here are some examples of SEO issues that I’ve faced caused by the Magento rewrite functionality.
Non-unique URL key entries causing URLs to change
There are a number of common Magento SEO issues that lead to -1, -2 etc being appended to URLs, including the use of duplicate URL keys. This can be caused by another page using the same URL key you’re inputting on a separate product or it could be that the given URL key has been used in the past. Magento’s default behaviour in this scenario is to add a rewrite to append the number at the end of the URL. I’ve found that website managers or execs often accidentally change these URLs (either via the admin interface or via a CSV upload), which leads to lots of changes in URLs.
This can also happen with categories, which is even more annoying as if the parent category URL changes, the children product URLs then change as well (although in more recent Magento versions the category path URLs canonicalise to the top-level URLs, making it less of an issue).
The most serious issues I’ve seen have all originated from bulk uploads via CSV, where Magento’s ended up getting confused by the URLs (or there’s been an error in the URL field) which has lead to the product URLs being rewritten. Also, once you realise this and want to switch back, you won’t be able to as the URL keys will already be in the rewrite table.
In order to resolve this issue, you need to delete the rewrite entry against the previous URL (this may need to be done for lots of entries) – I would suggest doing this alongside a developer and being very careful, as deleting incorrect rewrites (or all of the rewrites) can cause very serious issues.
There may well be a more efficient way to resolve this issue, which your developer will be able to provide more guidance on.
Duplicate content issues caused by /catalog/ URLs being indexed
If you’re using an early version of Magento, or if you’ve changed the option in the configuration, you could be using the ‘out of the box’ Magento (pre-rewrite) URLs, which look like this one:
You’ll see that this page still renders, because the rewrite isn’t working correctly. I’ve worked on some websites that have had over 1,000 duplicate versions of their product pages indexed as part of this.
This can also happen if you delete the Magento rewrite table (or specific entries), which would change your existing clean URLs without applying redirects / a rewrite rule to the previous.
A lot of the /catalog/ product URLs often exist in parallel (generally in newer implementations where the descriptive URLs are served by default. If you want to see if you have this issue, simply use the following search operator
This will show all applicable URLs that are being indexed.
In order to resolve this issue (if there are only a few URLs), I’d suggest either blocking the directory via the robots.txt file or assigning meta robots rules (I’d suggest noindex, follow) to these pages. If this is clearly a bigger issue and there are lots of these pages, I’d suggesting working alongside a developer to try and resolve the issue with the rewrites.
Constant URL redirect loops
I’ve seen this issue a few times around Magento upgrades, where URLs constantly rewrite without an obvious cause. I worked alongside a US-based retailer who were upgrading to Magento Enterprise 1.13 and when they’d finalised the development work, they realised that their product URLs were constantly changing.
The existing product URLs were being re-written with the numbers appended, as mentioned before (-1, -2 etc), but it was getting worse every time the rewrites were being indexed. There were some examples that were -29 and the rewrite table was getting very big, which would impact performance.
In the end, their developers worked alongside Magento’s team to create a fix, but this is something to keep an eye out for, as I’ve seen it happen on multiple occasions.
404 errors caused by changes to the rewrite table
In the event that you accidentally delete some or all of the rewrites from your rewrite table, you could cause a huge amount of 404 errors. I’ve seen this happen far too many times and it’s a nightmare from an SEO perspective. I’ve also seen this happen as part of Magento upgrade projects.
Often developers get tempted to remove rewrites or optimise the table as part of projects aimed at improving performance. This makes sense and is a good thing to do, it’s just key to do it on a staging site first and ensure that changes aren’t impacting the site from an SEO perspective. I’d suggest using either Screaming Frog or DeepCrawl to crawl the website before you think about deploying any changes (that impact rewrites) to the live website.
The 404 errors themselves can be a bit of a nightmare, as it’s difficult to create a convention to write a single rewrite rule afterwards to resolve the issue.
Here are some other useful resources on this topic:
You can also read my guide to Magento SEO.
If you have any questions about this, feel free to drop me an email ([email protected]). I also provide comprehensive Magento SEO audits, covering all aspects of Magento SEO and code audits, covering all technical issues with your platform.
Feel free to get in touch if you have any questions about Magento SEO.