November Happy Hour will be moved to Thursday December 5th.

SEO/Trailing slashes on URL's

Vote:
 

Hi,

Have an issue where we want to add trailing slashes to all URL's in a commerce site.

It's for SEO reasons. What is the best/correct way to do this?

I started with IIS rewrite rules but it seems to be hard to do it this way. It seems easy to break things and it seems to be hard to maintain.

I have to exclude so many path and it's seems easy to miss some path.

Some people in old posts suggest to use SegmentContext.PermanentRedirect but I'm not sure if this is the correct way.

It's anyway seems to be better choice then the IIS rules.

After the first try it don't seems to have any effect so I'm not sure.

Another options I have seen is UseTrailingSlash. But it's seems to only work on SEO url's and not on the hierarchical routing.

Also seen method SetupSeoUriPermanentRedirect but I'm not sure the effect of that or how to use it.

We use Commerce 11.2, CMS 10.10 and has hierarchial routing as below.

CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);

BR P-O

#190574
Edited, Apr 12, 2018 10:56
Vote:
 
#190575
Apr 12, 2018 10:57
Vote:
 

This has some good discussions: https://world.episerver.com/forum/developer-forum/Developer-to-developer/Thread-Container/2018/3/redirect-all-urls-so-they-end-with-/ 

#190580
Apr 12, 2018 11:32
Vote:
 

Thanks,

It seems as the answer could be found in that article.

I used the last example with RoutedContent and got it to work.

I just had to add some more criteria in our solution that the RequestUrl not should contain a question mark.

#190829
Apr 17, 2018 15:10
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.