Proper 301 Redirects for PXS Sites
There are basically two types of URLs you will want to setup to redirect when transitioning a site to the PXS system:
- Real page URLs (like www.mydomain.com/somespecialpage.aspx, and www.mydomain.com/search.html)
- Dynamic Pages using querystring parameters (like www.mydomain.com/events.aspx?eventid=12345)
Dynamic Page URLs
These are basically individual URLs that when entered you want to go to a new real page. The Sitefinity CMS platform supports mapping multiple URLs to a single page out of the box. You simply create the page needed on the site, then go to the properties tab of that page, and add the extra URLs you want redirected to the current page. For each one, check the box that says “Redirect to the default URL” and a 301 header will be passed to the client if the extra URL address is accessed. You can learn more about setting this up by reviewing the Sitefinity user guide on page 37.
In addition, I believe the server has been configured to allow you to upload an .htaccess file which you can use to manually override the system and perform redirects. You should test this before jumping to this solution though, as I have not used this myself, and can’t guarantee that all site will support it.
Dynamic Pages
These are pages where a parameter passed in (like eventID or categoryID) that would change where the user should be redirected. In general the querystring based pages are not SEO friendly, so we don’t use them in the PXS system. Instead every page uses verbose URLs. Since we can’t simply map the dynamic page to a direct page we can’t use the above 301 methods. Instead we need to read the parameter being passed in, and translate it to the real URL the new system uses to do the redirect. To accomplish this we created a control called "Querystring Redirect" and can be found under the “Analytics” grouping of available controls. You simply add it to a page mapped to the base URL of the dynamic page, then put the query string param in (everything after the "?") and where you want it to redirect in its settings. You can use it as many times as you want on a page.
If you have lots of different URLs you want to redirect based on different querystrings then I suggest you setup a single page like "/Templates/Redirects.aspx" on the site and add multiple URL's to the page using the page properties, then add the redirect control to that page for each unique redirect. Just make sure the new page has “show in menu” as off, and use a blank template so it isn't loading a bunch of stuff needlessly.
Example: If we were to redirect the Jeff Dunham page (http://www.mydomain.com/Event.aspx?EventID=22746) you would do the following:
- Create a new page “/Templates/Redirects.aspx” if you haven’t already done so.
- Add an “extra URL” to the new redirects page of “~/event.aspx”
- Add “Querystring Redirect” control to the redirects page with the following settings:
- Querystring: EventID=22746
- RedirectURL: /jeff-dunham-tickets.aspx
- Visible: True
- EnableViewState: False
- EnableTheming: False
Now all requests for the /events.aspx page will go to our redirect page, and our redirect page will redirect the user if the request includes a ?EventID=22746 in the URL. You may want to add a control to the redirect page with no querystring in case the user goes to the page direct. You will probably also want to add some content to the page in case a user hits the page, but a redirect match was not found.
You can use this one page for multiple dynamic pages as long as the querystring matches are unique. The redirect will not disseminate between the category.aspx vs. the event.aspx. So if you also want to redirect the “comedy” category, you would do the following:
- Add an “extra URL” to the new redirects page of “~/Category.aspx”
- Add “Querystring Redirect” control to the redirects page with the following settings:
- Querystring: CategoryID=2736
- RedirectURL: /comedians.aspx
- Visible: True
- EnableViewState: False
- EnableTheming: False
With the above you now have a dynamic redirect page handling redirects for your old events.aspx page as well as your old category.aspx page. You can obviously made adjustments above depending on what redirects are needed and how you want different scenarios handled, but between the extra URLs in the properties of pages, and this control – you have everything you need to map out your old URLs to the new system.