Redirects - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Redirects

  • Redirects
  • We are moving an existing site into Sitefinity.  Obviously the URLs are not all going to be exactly the same.  I would like to allow the content owners to be able to setup redirects from the old urls to the new Sitefinity urls.  This will also need to be used for other arbitrary redirects in the future.  I was thinking of creating a Sitefinity list or module that would contain the old and new urls.  Where does the code need to go to do these redirects?  I would assume code would be needed that runs on every request.
  • No extra work needed my friend, what you are asking for is built into the page properties.  If you look at a pages Title & Properties, check the box to Enable Multiple Urls for this page.  So if the contact pages used to be yourdomain.com/.../contact-us and now it is yourdomain.com/contact.  In the multiple urls area you will place ~/about/contact-us this will 301 redirect the old to the new. 
    Documentation:https://docs.sitefinity.com/administration-add-additional-urls-to-a-page

  •  
  • That works for URLs that are staying on this site, but we have some that will actually need to be redirected to another site since some are applications instead of just content and will be moved under a different, non Sitefinity managed, site.  We also have a need for some redirect urls (like mysite.com/gotosomething) to redirect to various locations, on and off the Sitefinity site.  My concern there is since those redirects are 301 permanent redirects, doesn't seem like there would be a way to redirect them elsewhere in the future if the need arose.  There any way to make these 302 redirects?
  • I think I found a solution, although not a really pretty one.  Instead of using a redirect page for URLs I might want to re-point some day, I can use a regular page and set a meta refresh in the page properties to redirect to the needed URL.  Still a multi-step process so not real clean, but at least it's manageable within Sitefinity.  If you have any other options, please let me know.