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

Forums / Set-up & Installation / IIS7 Rewrite Module Compatibility

IIS7 Rewrite Module Compatibility

11 posts, 0 answered
  1. Steve .
    Steve . avatar
    14 posts
    Registered:
    14 Apr 2010
    17 Jun 2010
    Link to this post
    Hi there,

    I'm looking to make use of IIS7s URL rewrite module (http://learn.iis.net/page.aspx/496/iis-url-rewriting-and-aspnet-routing/) however my Sitefinity installation seems to be causing a rewrite to fail.

    The idea is to do an internal rewrite on a URL so that it is internally rewritten to serve the content from another. e.g.

    http://www.example.com/MY-TEST-URL will show the content from http://www.example.com/MY-REAL-CONTENT without changing the URL in the browsers address bar i.e. it's a server side rewrite.

    I've succesfully configured this for static files within IIS7 and for the site but the rules fail when trying to serve content from Sitefinity - a 404 error is returned.

    I'm guessing Sitefinity is picking up the original request headers somehow, but would like to change this behavoir.

    I realise I can add aliases for pages in Sitefinity, but unfortunately this doesn't fit my use case - I'm trying to serve the home page without a path i.e. so that http://www.example.com/ serves http://www.example.com/home without a 301 redirect. The "alias" functionality doesn't allow blank URLs.

    Any ideas appreciated.

    Cheers,

    Steve
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    17 Jun 2010
    Link to this post
    Hello Steve .,

    Make sure that the UrlRewrite module is declared before the CmsHttpModule in the system.webServer/modules configuration sections. On a side note we do have a built in URL rewriter which does exactly what you are looking for. It is working both in IIS 6 and IIS7. More information can be found here.

    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
  3. Steve .
    Steve . avatar
    14 posts
    Registered:
    14 Apr 2010
    17 Jun 2010
    Link to this post
    Hi Radoslav,

    Thanks for the quick response. Would you mind confirming a few details for me please?

    - In which file do the references to CmsHttpModule and UrlRewriteModule appear? Or is it the case that the URL Rewrite module is automatically added to the config?

    - If we need to add the URL Rewrite module to the config automatically, would you mind helping me out with the format of that reference please? i.e. what should be written and where should it be placed?

    I'll look in to the Sitefinity Rewrite solution - looks good - but we're in rather a rush at the moment, and could do with getting the existing solution up and running.

    Thanks for your help.

    Steve
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    17 Jun 2010
    Link to this post
    Hi Steve .,

    The CmsHttpModule as other http modules in ASP.NET web sites is declared in the web.config file in the sections system.web/httpModules for IIS 6.0 as system.webServer/modules for IIS 7.0. When you add a module from IIS it is registered in your website's web.config file in the above mentioned sections. Make sure that the IIS UrlRewrite module is hit first when a resource is requested (register it before other http modules).

    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
  5. Mark
    Mark avatar
    86 posts
    Registered:
    08 Feb 2010
    17 Jun 2010
    Link to this post
    its now fact that a 301 looses a bit of credit with google - so i'm told

    so based on this, and the fact the homepage is the most important page.
    What is the easiest way for it to not 301 redirect to
    mysite.com/home

    and just serve
    mysite.com

    cheers
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    17 Jun 2010
    Link to this post
    Hello Dave,

    Could you try to:
    1) Create your home page in sitefinit (name it home.aspx for example) and set it as home page from the admin as in the attached image.
    2) Go to IIS management tool and navigate to the Default documents section on your website. From there add the home.aspx document to the list of default documents.

    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
  7. Mark
    Mark avatar
    86 posts
    Registered:
    08 Feb 2010
    17 Jun 2010
    Link to this post
    Thanks

    thats great, but we use extensionless urls
    how would we do that ?
  8. Mark
    Mark avatar
    86 posts
    Registered:
    08 Feb 2010
    17 Jun 2010
    Link to this post
    i've tried setting home.aspx as the default document
    however, when you browse to site.com it still redirects to /home.aspx
  9. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    18 Jun 2010
    Link to this post
    Hello Dave,

    If you are using externsionless urls try modifying web.config like this:
    <cms defaultProvider="Sitefinity" redirectToHomePage="false" pageExtension="" siteTemplate="" projectName="Extensions" disabled="false" pageEditorUIMode="Overlay">

    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
  10. Mark
    Mark avatar
    86 posts
    Registered:
    08 Feb 2010
    24 Jun 2010
    Link to this post
    yes thats the solution!
    coupled with a url rewrite in IIS7 from "home" to "/"
    and also a 301 url redirect incase home is every hit

    thanks
  11. Joe Groner
    Joe Groner avatar
    2 posts
    Registered:
    26 Oct 2009
    15 Jan 2011
    Link to this post
    I think the problem may be that the CmsHttpModule is using the Request.RawUrl to determine which page to materialize.  We were able to get around this by inheriting from CmsHttpModule and overriding GetCmsRequest with the following signature:

    public class MyCmsHttpModule : CmsHttpModule
    {
        protected override CmsRequest GetCmsRequest(System.Web.HttpContext context)
        {
            return new CmsRequest(context.Request.Url.PathAndQuery);
        }
    }

    Then it is a simple matter of changing the module definition in the web.config file to point at your new module.

    I would suggest that Telerik consider making this change to better support the IIS Url Rewrite module (and perhaps other modules as well).

    Regards,
    Joe
Register for webinar
11 posts, 0 answered