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

Remove trailing slashes in Optimizely 12

Vote:
 

Is there a way to remove trailing slashes on front end pages only in Optimizely 12?   This seems to cause an issue with the CMS when I add it to startup.cs

                var options = new RewriteOptions()
                    .AddRedirect("(.*)/$", "$1", 301 /* Moved Permanently */);
                app.UseRewriter(options);

It was causing a websockets issue so I turned it off for now.

#298435
Mar 16, 2023 18:22
Vote:
 

Try setting RoutingOptions.UseTrailingSlash to false. Either in Startup.cs or in your appsettings.json file.

This would be the purest solution, as it avoids adding it in the first place.

#298436
Mar 16, 2023 19:42
Vote:
 

What was the websockets issues you were facing ? 

you have done in a similar manner described here https://world.optimizely.com/blogs/Minesh-Shah/Dates/2023/2/url-rewrites-in-cms12--net-6-/ 

and I did not face any issues using

options.AddRedirect("(.*)/$", "$1");

#298473
Edited, Mar 17, 2023 0:39
* 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.