Handling dot(.) in 301 URLs with SXA Redirects

Recently for one of our project we were adding 301 Redirects in Sitecore that is based on SXA, created SXA Redirect map Item based on “Redirect Map” template and starting adding the URLs(old and new URLs mapping).

What we observed that 50% of the URLs had dot (.) in it with specific extension (for example- .oldextension), so when we tested that entry that didn’t worked as expected because of Sitecore not processing that specific extension.

The same scenario has been listed here as well- https://sitecore.stackexchange.com/questions/2413/301redirectmodule-isnt-working-for-url-with-dot-file-name

So- what’s the solution? how to handle dot (.) in the old URL and redirect to new URL using SXA?

There are two options we have:

Define static rules using IIS URL Rewrite module

In this case what we can do is- create different rules for handling different URLs and redirect to the target URLs directly from IIS, assuming we have the following URL mapping:

Old URL- http://site.local/category.oldextension and New URLhttp://site.local/categorylanding– we can use the following IIS rule to handle the redirect.

<rule name=”301RedirectRule1″ stopProcessing=”true”>
<match url=”^(category.oldextension)$” />
<add input=”{HTTP_HOST}” pattern=”^site.local$” />
<action type=”Redirect” url=”http://site.local/categorylanding&#8221; />

In the above case we won’t be using SXA Redirects to handle 301 redirects, how about when we have several hundreds of items? I think it doesn’t make sense to keep adding all the static URLs to IIS, so to support this we can go for second solution which is listed below.

Add the specific rule to remove the dot from the URL

In this approach we write an IIS rule to remove the dot from requested Old URL, for e.g. we change http://site.local/category.oldextension to http://site.local/categoryoldextension

<rule name=”Remove Dot For Redirect” stopProcessing=”true”>
<match url=”^(.*[^.])\.oldextension+$” />
<action type=”Redirect” url=”{R:1}oldextension” />


Once we have the above rule set- we can just add the above URL(without dot in it) in SXA redirect and then the redirect should work as expected.

Advantage of above approach is that we just have to set one rule and all the URLs are managed directly in Sitecore and content editors can make the change as and when required.


Hope this helps!

Happy learning 🙂



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s