Remove .html from Url using web.config produces errors
Hi All,
I've got a rewrite rule in web.config which is rewriting the URL to remove .html from all requests which is great, works like a charm.
However it produces an error when looking in the CMS at any page which contains a Macro, where the Macro is unable to find the "GetMacroResultAsHtmlForEditor".
I'm not convinces at publishing a page which produces errors for obvious reasons (it's a live site).
I'm convinces that the rewrite rule is doing something to the Backend which is not great!
The error is:
Request error: The URL returned a 404 (not found):
/umbraco/backoffice/UmbracoApi/Macro/GetMacroResultAsHtmlForEditor
with data:
{"macroAlias":"ImageSlider","pageId":"1258","macroParams":{}}
Contact your administrator for information.
I'm not sure this is the answer, but one thing I noticed in your regex, is that the . before the html isn't escaped...
and . in regex parlance means match anything and so maybe your:
(.*).html
isn't matching everything before the .html
but just being greedy and matching everything with html in
can't see how it's necessarily related to the issue you are seeing but thought maybe
(.*)\.html
might be closer to what you were trying to achieve, so apologies if it's a digression to the main question but thought I'd mention it anyway, not that I can ever remember what regex syntax should properly be!
Hi marc goodson, thanks for that, it did correct the GetHtml.. error so big thanks for that!
However, something else that I've noticed is that when adding an element to the grid, something that requires a setting input (such as a macro) the slide-in config page is blank.
I suspect this rewrite is doing more harm than good and I should look for an alternative.
Many thanks though, getting there!
ahh, it's just to rewrite an old version of your site on the front end now you've moved to Umbraco and you want to make sure old links to the .html versions still work / redirect correctly.
In which case you may have some joy by excluding the rewriting from applying to any request within the Umbraco folder - so it doesn't clash with the innerworkings, that will use .html files as views for some of the backoffice bits:
Remove .html from Url using web.config produces errors
Hi All, I've got a rewrite rule in web.config which is rewriting the URL to remove .html from all requests which is great, works like a charm.
However it produces an error when looking in the CMS at any page which contains a Macro, where the Macro is unable to find the "GetMacroResultAsHtmlForEditor".
I'm not convinces at publishing a page which produces errors for obvious reasons (it's a live site). I'm convinces that the rewrite rule is doing something to the Backend which is not great! The error is:
Request error: The URL returned a 404 (not found): /umbraco/backoffice/UmbracoApi/Macro/GetMacroResultAsHtmlForEditor with data: {"macroAlias":"ImageSlider","pageId":"1258","macroParams":{}} Contact your administrator for information.
and the rewrite rule is:
can anyone advise / help with this please? Umbraco version 7.4.3 assembly: 1.0.5948.18141 and using EUKHosts Plesk Hosting
Many thanks
Rhys
I'm not sure this is the answer, but one thing I noticed in your regex, is that the . before the html isn't escaped...
and . in regex parlance means match anything and so maybe your:
isn't matching everything before the .html
but just being greedy and matching everything with html in
can't see how it's necessarily related to the issue you are seeing but thought maybe
might be closer to what you were trying to achieve, so apologies if it's a digression to the main question but thought I'd mention it anyway, not that I can ever remember what regex syntax should properly be!
Hi marc goodson, thanks for that, it did correct the GetHtml.. error so big thanks for that! However, something else that I've noticed is that when adding an element to the grid, something that requires a setting input (such as a macro) the slide-in config page is blank. I suspect this rewrite is doing more harm than good and I should look for an alternative. Many thanks though, getting there!
Hi Rhys
ahh, it's just to rewrite an old version of your site on the front end now you've moved to Umbraco and you want to make sure old links to the .html versions still work / redirect correctly.
In which case you may have some joy by excluding the rewriting from applying to any request within the Umbraco folder - so it doesn't clash with the innerworkings, that will use .html files as views for some of the backoffice bits:
eg add to your conditions:
see if that helps.
regards
Marc
is working on a reply...