I'm trying to set up my site so that web page URLs without a trailing slash redirect to the same URL with a trailing slash (e.g. "/company" becomes "/company/"). The problem I've run into is that, with standard URL rewriting in web.config, all URLs are affected, including those used by Umbraco and the site's plugins. I've added several paths to a list of exclusions on a standard rewrite rule, but things keep breaking.
Is there a way we can set up a redirect like this in a way that only affects externally-facing web page URLs?
URL rewriting for front-end pages only?
Hi,
I'm trying to set up my site so that web page URLs without a trailing slash redirect to the same URL with a trailing slash (e.g. "/company" becomes "/company/"). The problem I've run into is that, with standard URL rewriting in web.config, all URLs are affected, including those used by Umbraco and the site's plugins. I've added several paths to a list of exclusions on a standard rewrite rule, but things keep breaking.
Is there a way we can set up a redirect like this in a way that only affects externally-facing web page URLs?
Any suggestions would be appreciated!
-David
HI David
I usually go in the opposite direction, removing the ending slash and redirecting /company/ to /company.
But in the rule you could 'negate' the umbraco folders eg
or have a look at this approach which explains setting up a whitelist:
https://24days.in/umbraco-cms/2014/redirect-rules/
Also to avoid un-necessary redirects, make sure in UmbracoSettings.config you have 'addTrailingSlash' set to true:
is working on a reply...