+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Sitefinity page redirects, short URLs, IIS URL Rewrite module, etc.

Sitefinity page redirects, short URLs, IIS URL Rewrite module, etc.

11 posts, 0 answered
  1. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    30 Jul 2010
    Link to this post
    Hello.

    I'm in the process of migrating our main Sitefinity site from IIS6 to IIS7.5, so I started looking at various new things in IIS7+ that I can take advantage of: Integrated Pipeline Mode, URL Rewrite Module, etc.  When it comes to URL rewriting, I know Sitefinity has the built in way to provide "other URLs" to any given page in the sitemap.  This works great for when I want my /group1/group2/page.aspx to also be available as, for example, /something/differentName.aspx.  I also noticed that if I want to make a short, EXTENSIONLESS URL to a page, I still have to add the additional URL with the extension into Sitefintiy.  For example, if I have:

    /group1/group2/page.aspx

    ...and I want it available also as:

    /myShortUrl

    ... this means that I have to go to Sitefinity, Page properties, add an additional URL of "~/myShortUrl.aspx".  This is a little counter-intuitive to me, but it works (I can type in www.mysite.com/myShortUrl in the browser and I get the right result).  If I'm going wrong about setting that up, please let me know.

    Now...  If my old, pre-sitefinity site had addresses such as /folder/folder/page.html, and I'd like them to redirect to the new pages, how would I do that with Sitefinity redirect mechanism?  I can't seem to be able to simply add an additional URL of "~/folder/folder/index.html" and redirect to /group1/group2/page.aspx.

    So one question is: how would I do that with Sitefinity?  Second question is, even if I could do that with Sitefinity, should I perhaps be using the IIS URL Rewrite Module instead.  It seems to be made exactly for this sort of purpose, and although Sitefinity might be able to cover most of those needs, I wonder if I should switch to that.  It would also help keep all redirect mappings and short URLs in one place (root web.config).

    Has anybody gone through this thought process already and made a decision as to what's best long-term?  Thanks.

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    02 Aug 2010
    Link to this post
    Hi Marko,

    Thank you for using our services.

    Sitefinity has 2 built in mechanisms for url rewriting. The first one is the one which you are using - though page properties for your pages. The second one is by using our built in UrlRewriter. This one uses regular expressions to match urls to some pattern and rewrite them to another. Both approaches can be used for your purposes.

    The first one, when you add another Url for your page you will have to check the Redirect to the default URL check box - this will make the system respond with a permanent redirect (302).

    The second approach is to configure Sitefinity to use the UrlRewriteModule, you can refer to this webinar. Then in your web.config provide the rules and  provide the rule mode to be PermanentRedirect or TemporaryRedirect:
    <urlrewrites>
        <rule mode="PermanentRedirect">
            <url>rule</url>
            <rewrite>rewritepattern</rewrite>
        </rule>
    </urlrewrites>


    Sincerely yours,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    02 Aug 2010
    Link to this post
    I see.  So with the URL Rewriter in Sitefinity, I can achieve this using, for example:

    <rule mode="TemporaryRedirect">
        <url>myShortUrl</url>
        <rewrite>Group1/Group2/myPage.aspx</rewrite>
    </rule>

    I'm finding that, to achieve the same thing with the Page Properties approach, I have to add the new url as "~/myShortUrl.aspx."   If I don't include the extension then I get the 404 error.  However, linking to www.mysite.com/myShortUrl (without the extension) works just fine.  in other words, if I want to have an extensionless short url to a page in sitefinity, I would add it to the page properties WITH an extension (~/myShortUrl.aspx), but I would be allowed to link to it without one (mysite.com/myShortUrl).  Is this expected behavior?

    One problem I'm running into with the Page Properties approach, is when urls have non-aspx extensions.  For example, if I want to redirect:

    ~/folder/oldPage.html

    to

    ~/group1/group2/newPage.aspx.

    Is that possible with the Page Properties approach, or do I have to use the Sitefinity URL Rewriter?

  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    04 Aug 2010
    Link to this post
    Hello Marko,

    Thank you for getting back to me.

    If you set your site to use extensionless urls you will not need to specify extension while adding additional urls though page editor. Also if you use the rewriter without specifying mode for the rule it will keep the requested url in the browser Url bar, however will display the page which is under the rewrite rule. If you wish to use other urls such as html you should first enable the html extension from web.config:
    <cms defaultProvider="Sitefinity" pageExtension=".aspx" additionalExtensions=".html" siteTemplate="" projectName="Sitefinity37SP3" disabled="false" pageEditorUIMode="Overlay">


    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    04 Aug 2010
    Link to this post
    Ah, thanks!  I wasn't aware of the additionalExtensions attribute.  That seems to work well!

    Regarding extensionless urls....  At this point, I'm not really needing to switch my site to be entirely extensionless, so I don't want to set pageExtension="" because i still want my pages to come up with .aspx extension in the web browser.  Eventually, I might get there, but right now, I'm merely trying to see if I can provide an ADDITIONAL (alternative) URL to an existing page, where the additional URL is extensionless.  I don't mind including the extension in the page properties when adding "~/myShortUrl.aspx" AS LONG AS I can rely on actually being able to link to the page without using the extension.  And that seems to work ok.

    And regarding the redirects...  Yes, I saw that if I don't specify the redirect type in the URL Rewriter, it will serve up the content while continuing to show the alternative URL.  However, in most cases, I simply want to redirect to the default url, while providing users with an alternative short URL which can be easier to remember as the starting point.

    By the way, what kind of redirect does Sitefinity perform when using the Page Properties "redirect to default URL" checkbox?  Permanent, temporary, etc.?
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    05 Aug 2010
    Link to this post
    Hello Marko,

    Well you need to set the pageExtension to "" to be able to serve extensionless requests. All you need to do is to perform the instructions in the user manual without this step. This will let you serve both urls with extension and without.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    05 Aug 2010
    Link to this post
    Well, for IIS7, that was the only step, so I guess I don't have to do anything!  :-)

    In all seriousness, I think I should be in good shape with the current setup.  With IIS7 integrated mode, all of my URLs seem to be responding to URLs with .aspx extension or URLs without any extension.  The only trick is when I add short URLs, I have to remember to add in the extension, but I can link to the page without the extension.  BUT, I can only do this to perform a redirect, not to actually serve up the extensionless "alternative" URL, which is fine for what I need.
  8. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    05 Aug 2010
    Link to this post
    Hello Marko,

    IIS 7.0 automatically serves extensionless urls. If you use the url rewriter module instead of additional urls you will be able to serve the short extensionless url and just perform rewrite not redirect.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    05 Aug 2010
    Link to this post
    Right, I know.  But you're missing my point.  I don't want to serve extensionless URLs, at least not right now.  All I want to do is add additional SHORT urls to some specific pages (that are deep down in the sitemap), in order to provide for an easier link, which can be shared in emails easily, remembered more easily, etc.  Such short urls would only serve as entry points to the website at various spots, and they would simply redirect to the default page.  So to make such short urls even more short and user-friendly, I want THEM to be extensionless, but only so that a user can type in www.mysite.com/myShortUrl and not get a 404 error or something.  I don't actually want to serve a page at that url--simply redirect to the www.mysite.com/something/grouo/anothergroup/page.aspx.  And it sounds like I can do this easily with IIS7 + Sitefinity "page properties" approach, as long as I add the "other URL" with an extension.

    The second thing I needed was the ability to redirect www.mysite.com/folder/oldPage.html to www.mysite.com/group/group/newPage.aspx.  I knew I could do it with URL Rewrite Module, but I was trying to find out if there's a way to do it with built-in Sitefinity tools.  And the quickest solution to that is using the "additionalExtensions" attribute in the web.config, then adding the additional urls to Page Properties of needed pages.

    So, I think I'm good.

  10. Dan
    Dan avatar
    5 posts
    Registered:
    14 Aug 2014
    26 Mar 2015 in reply to Radoslav Georgiev
    Link to this post

    I have a similar situation. I need to redirect this url:

    http://www.nln.org/researchgrants/PDF/2014NLNBiennialSurveyofSchoolsofNursingworksheet.pdf

    to a pdf on our new website. I found the place to Allow multiple URLs for this item, but it won't accept a url that has the ".pdf" extension. What can I do?

    thanks

  11. Mark
    Mark avatar
    3 posts
    Registered:
    21 Feb 2015
    10 Aug 2015
    Link to this post

    Hi guys

     

    i too have the same issue here, we are migrating from Umbraco to Sitefinity and I am finding the per page redirect tool very tedious and time consuming. What I want is a marketing user interface to see urls that are 404ing and the ability to create both 302 and 301 redirect in ONE central place. I could do this in Umbraco via URL Tracker  (https://our.umbraco.org/projects/developer-tools/301-url-tracker) and used to do this in Episerver. Definitely something that needs creating to make it easier

    Mark

Register for webinar
11 posts, 0 answered