I just installed the URL Rewrite Module for Sitecore 8.1. However, I do not believe the simple redirects are working correctly. I get my page not found page versus getting the page I want redirected to. The documentation is not very clear either. I need to know what is the proper format for the Path field in the in Simple Redirect template. For example, do I put in http://www.xyzcompany.com/about/test/testpage or /about/test/testpage or what exactly is the proper format here? I just want an incoming old URL to go to the new URL, plain and simple. If someone has a working instance of URL Rewrite Module with Sitecore 8.1 that can help to make my simple redirects work I would greatly appreciate any insight. Thanks in advance!
3 Answers
In my investigation and research into this issue I spoke with Andy Cohen the contributor for this module and he let me know that here is the proper format for Simple Redirect paths:
http://xyzcompany.com/about would just be about
in the Path field just the name of the page.
However, if you have a page that is multiple pages deep you separate the folders with a pair of arms (regex stuff). It will look something like this:
http://xyzcompany.com/about/tom/dick/harry would be: about\/tom\/dick\/harry
in the Path field.
I verified this works and my redirects are working. Hope this helps someone else. Happy coding!
-
Hi Toby, any idea if this module supports site specific redirects? working with a mutli site solution resolving to different domain names?– JayCommented Mar 26, 2020 at 11:37
The simple redirects assume that your matching url is at the root. There is no need for a beginning forward slash.
When you installed the module, it comes with examples located at /sitecore/Content/Sample Rewrites. There is an example of both of these situations; one for external links and one for internal links, named accordingly:
Simple External Redirect
Path: external1
Target: http://www.sitecore.net (external link)
Simple Internal Redirect
Path: internal1
Target: /Home (internal link to an item)
If your path was more complex and had multiple segments, you just need to make sure that you properly escape the forward slashes:
about/me
Generally, the module works exactly like the IIS rewrite module. Here is the most recent blog post that I have written on my module: https://blog.horizontalintegration.com/2016/09/08/sitecore-url-rewrite-backreferences/. If you need anything else, bug reports, feature requests, etc... let me know.
Andy
-
I am trying to follow the instructions, in the simulator everything looks good, but when I get to the browser and try to visit the url, I get a sitecore error page, no layout error. Any ideas?– TonyCommented Nov 6, 2017 at 17:13
-
Hi Andy, how does this work with a multi-site sitecore solution? meaning if you have multiple domains active on the same solution, how is it possible to make the redirects domain/site specific?– JayCommented Mar 18, 2020 at 12:43
-
Yes it does. But this hasn't been updated in a long time. The site specific settings have a special field type that look at the site definitions to populate the dropdown - I don't think this will work with SXA virtual sites - but I don't know. On the root of a redirect folder, on the Content tab is a Site Name Restriction field, where you can choose the site. Commented Mar 19, 2020 at 13:24
The path should be the relative to the root of the site (no scheme or domain). It sounds like you also have an error page module or custom built functionality also installed. My guess is that module is running and returning your 404 page before the URL Rewrite module has a chance to run. Check the httpRequestBegin pipeline in /sitecore/admin/showconfig.aspx to see if there is a not-found processor before the URL Rewrite. If so, try adjusting your patch configs so that the URL Rewrite module runs first.