Contact Us

Let us know to help you out quickly!

 Pritesh     Feb,08 2017

Tag SES URL Throw 404 Error If Tag Has Special Characters Other Than '-'

Recently working on MuraCMS (opensource Content Management System build on CFML) for our company website. While working on blog section where we used to have tag for each post. For one of post we have tagged which include space and dot, when we click on through tag link SES URL it throws 404 error. This only happen if you are using URL rewriting to remove index.cfm from URL. After little bit of debugging I found that it was due to rewrite URL, default rewrite URL script provided by MURA doesn't support redirection of URL having special character other than '-'. This is will work fine for search by page, category etc as MURA itself change it value with SEO friendly but in case of tag it doesn't. 

You can get rid of this issue by just adding below rewrite URL in your web.config file.

<rule name="Mura CMS Rewrite TAG Option 1"><match URL="^([a-zA-Z0-9/-]+/tag/.+|tag/.+)$" /><action type="Rewrite" URL="/index.cfm/{R:1}" logRewrittenUrl="true" /></rule><rule name="Mura CMS Rewrite TAG Option 2" enabled="false"><match URL="^([a-zA-Z0-9-]{1,})/([a-zA-Z0-9/-]+/tag/.+|tag/.+)$" ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{DOCUMENT_ROOT}{URL}" matchType="IsDirectory" ignoreCase="false" negate="true" /></conditions><action type="Rewrite" URL="/{R:1}/index.cfm/{R:2}" /></rule>

Above rule only apply if URL has word 'tag' and tag value with special characters rest of request will handle by URL rewrite code provided by MURA. I haven't check with .htaccess but same regular expression should work fine as well but test on development first.