Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ai 2 posts 22 karma points
    Jan 21, 2011 @ 15:28
    Ai
    0

    IIS7 url rewrite module

    Hi,

     

    My site uses sits in an IIS7 server and it uses the iis7 rewrite modul for our rewrites.

    Umbraco uses its own rewrite modules, so my question is, can you use both?

    Umbraco seems to intercept all requests so my iis7-rewrites are all bypassed.

     

    best regards,

    Ai

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jan 21, 2011 @ 15:54
    Stefan Kip
    1

    Yes you can use both.

    The IIS rewrite rules will be executed before the umbraco rewrite rules in the 'request stack'

  • Eric Schrepel 161 posts 226 karma points
    Feb 26, 2013 @ 02:13
    Eric Schrepel
    0

    Is this resolved? I'm also not seeing my rules in IIS7's URL Rewriter 2.0 module having any effect. The <rewrites> section in web.config gets created/updated correctly via IIS, but then trying to type a link into the browser that should redirect based on that rewrite rule just creates a 404 page in Umbraco.

    Here's what gets written as the rewrite rule; maybe I'm just not getting the rule right, but what should happen is users going to www.nwcouncil.org/energy/rtf/whatever (our Umbraco site) get redirected out of our Umbraco site and to another server as rtf.nwcouncil.org/whatever. Instead I just get a 404 error when input www.nwcouncil.org/energy/rtf/whatever

    <rewrite>
       <rules>
          <rule name="RTF" patternSyntax="Wildcard" stopProcessing="true">
             <match url="http://www.nwcouncil.org/energy/rtf/*" />
             <action type="Redirect" url="http://rtf.nwcouncil.org/{R:1}" />
          </rule>
       </rules>
    </rewrite>

    Or is it because of any of these other lines in web.config that are maybe preventing the IIS module from running?

    <configuration>
      <configSections>
        <section name="urlrewritingnet" restartOnExternalChanges="true" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
    </configSections>

      <urlrewritingnet configSource="config\UrlRewriting.config" />
        <httpModules>
          <!-- URL REWRITER -->
          <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
    
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true">
          <remove name="UrlRewriteModule" />
          <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
    
  • Stefan Kip 1614 posts 4131 karma points c-trib
    Feb 26, 2013 @ 09:15
    Stefan Kip
    0

    Yes you're doing it wrong ;-)

    The url matching matches the URL after the hostname and slash, so instead of '<match url="http://www.nwcouncil.org/energy/rtf/*" />', you should use '<match url="energy/rtf/*" />'.

    Also you're using the backreference {R:1}, but there's not capturing group.
    Therefor you should use regex, which will end up in this:

    <rule name="RTF" stopProcessing="true">
    <match url="(energy/rtf/.*)" />
    <action type="Redirect" url="http://rtf.nwcouncil.org/{R:1}" />
    </rule>

    Or if you want to use the part after 'energy/rtf/', you should use this:

    <rule name="RTF" stopProcessing="true">
    <match url="energy/rtf/(.*)" />
    <action type="Redirect" url="http://rtf.nwcouncil.org/{R:1}" />
    </rule>

    Lot's of information can be found here: http://www.iis.net/downloads/microsoft/url-rewrite

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Feb 26, 2013 @ 09:16
    Stefan Kip
    0
  • Michael Clausing 6 posts 26 karma points
    Apr 14, 2014 @ 21:17
    Michael Clausing
    0

    Is there any way to use a Rewrite instead of a Redirect? I am looking to rewrite a specific url of an umbraco site to a localhost for a store (IE www.example.com/store to localhost/store.) I've installed ARR 2.0 and set it up correctly using a non umbraco site, but am having trouble implementing it with the umbraco config. It seems to be picked up by the umbraco routing and displays a 404.

    I know my rule is correct, because it works correctly as a redirect.

                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="^store/(.*)" />
                    <conditions>
                        <add input="{CACHE_URL}" pattern="^(https?)://" /> 
                    </conditions> 
                    <action type="Rewrite" url="{C:1}://localhost/store/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_ACCEPT_ENCODING" value="" /> 
                    </serverVariables> 
                </rule>  
    

    Is there any way to have umbraco not attempt to find these pages?

    I may end up setting up a blank site otherwise and setting up rewrites for both.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 14, 2014 @ 21:27
    Jan Skovgaard
    0

    Hi Michael and welcome to our :)

    So if I get this right you have a store page, which should not be picked up by Umbraco because it has nothing to do with Umbraco?

    Then you need to add it to the <add key="umbracoReservedUrls" value="~/store" />

    Hope this helps.

    /Jan

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Apr 14, 2014 @ 21:29
    Stefan Kip
    0

    AFAIK rewriting isn't possible to another domain...

  • Michael Clausing 6 posts 26 karma points
    Apr 14, 2014 @ 21:50
    Michael Clausing
    0

    Jan,

    That worked. Thanks you are a life saver!

    kipusoep,

    It only works if you use the ARR module for IIS. You have to enable the proxy at the server level.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 14, 2014 @ 21:57
    Jan Skovgaard
    0

    Hi Michael

    Happy to hear that - If you add some point need to exclude a whole folder you can look at the umbracoReservedPaths key.

    Have a nice evening.

    /Jan

  • Michael Clausing 6 posts 26 karma points
    May 12, 2014 @ 22:42
    Michael Clausing
    0

    Jan,

    I'm having an issue with enabling "umbracoUseDirectoryUrls" in conjunction with the method above. My reverse proxy site uses a webservice at "/foo/searchService.asmx/Search". Even though I have "umbracoReservedPaths" set to "~/foo", it returns a 404. I know it's not making it past the the umbraco site as the 404 page is .net 4.0 specific.

    I do not receive a 404 if "umbracoUseDirectoryUrls" is set to false.

    I would just modify the url structure of the searchservice.asmx, but I would rather keep my reverse proxy site as close to out of the box as possible. I also am not sure if this happens with any other pages.

    Is there anyway to make umbraco ignore "umbracoUseDirectoryUrls" for my ~/foo path?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 12, 2014 @ 22:47
    Jan Skovgaard
    0

    Hi Michael

    Hmm, if it's the whole folder you want to add then you shoul probably use the <umbracoReservedPaths> setting instead - As you can see by default "Umbraco" and "Install has been added.

    Hope this helps.

    /Jan

  • Michael Clausing 6 posts 26 karma points
    May 12, 2014 @ 23:26
    Michael Clausing
    0

    Jan,

    I am using this. I have even tried to specify it.

    <add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,~/foo,~/foo/searchService.asmx/" />
    

    No matter what I try umbraco returns a 404 when I attempt to access it as "umbraco.domain/foo/searchService.asmx/Search". It works fine if I try to access "umbraco.domain/foo/searchService.asmx" or access "umbraco.domain/foo/searchService.asmx/Search" after changing web.config to

        <add key="umbracoUseDirectoryUrls" value="false" />
    

    It is definitely directly related to "umbracoUseDirectoryUrls" and the "/" at the end of "umbraco.domain/foo/searchService.asmx/"

  • Michael Clausing 6 posts 26 karma points
    May 19, 2014 @ 22:02
    Michael Clausing
    0

    Jan,

    Is there any chance some sort of route is ignoring the <umbracoReservedPaths> node if there is a trailing slash on a .asmx? If so, is there a way to modify it and or delete/add with regex so it doesn't get picked up?

    I should mention, our client is running on an older version, 4.11.

  • Roger 195 posts 474 karma points
    May 20, 2014 @ 13:37
    Roger
    0

    Hi guys, im also having a rewrite issue if anyone can help me please?

    I have a multilingual website with 2 cultures: /en (english) and /cy (welsh)

    The main URL for the english version is lovefostering.co.uk and for the welsh version its carumaethu.co.uk

    The client wants carumaethu.co.uk to hit the /cy to present the user with the correct language from the correct URL.

    I have set up all the bindings in IIS with both domains and if I type in carumaethu.co.uk/cy it all works fine.

    My issue is:

    How do I send requests from carumaethu.co.uk and www.carumaethu.co.uk to carumaethu.co.uk/cy

    Either in IIS or using Umbraco itself.

    Many thanks in advance!

  • Michael Clausing 6 posts 26 karma points
    May 20, 2014 @ 18:43
    Michael Clausing
    0

    Just wanted to update my issue:

    I found the function that I believe is causing the issue. It is located at UmbracoModule.cs:182 - function EnsureDocumentRequest. I may end up modifying this and recompiling it. I will update this thread if I do.

    As for your issue Roger, it sounds like you're just looking for a redirect? I'm not that familiar with umbraco, but if you want all requests carumaethu.co.uk and www.carumaethu.co.uk to carumaethu.co.uk/cy - you could do that easily in IIS.

    Something like this stackoverflow post should work.

  • Tyrone 1 post 21 karma points
    Jun 25, 2014 @ 06:40
    Tyrone
    0

    I have the same issue, my rule works fine as redirect. But as a Rewrite it just returns 404.

    I have tried adding the path to umbracoReservedUrls and to umbracoReservedPaths, but neither of these work.

    I have tried the other solutions mentioned, but none seem to work.

    Here's my rule.

     <rule name="Reverse Proxy to webmail" stopProcessing="true"> 
        <match url="^articles/autocomplete(.*)$" />
        <action type="Rewrite" url="http://www.stuff.co.nz/{R:1}" />
    </rule>

    Running IIS 7.5, ARR installed, Umbraco 7.0.4

Please Sign in or register to post replies

Write your reply to:

Draft