Copied to clipboard

Flag this post as spam?

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


  • sundip 76 posts 339 karma points
    Jan 23, 2013 @ 18:47
    sundip
    0

    /umbraco/login.aspx redirects to main domain

    Hi,

    I am trying to redirect the .aspx url's to without .aspx like /maindomain/product.aspx to /maindomain/product as client requested.

    I did the following:

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

    <addTrailingSlash>false</addTrailingSlash>

    and then I added the rule if someone try to add .aspx manually after the url then it will also redirect.

      <add name="rule1"

              redirect="Domain"

              ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"

              virtualUrl="http://maindomain.com/(.*).aspx"

              redirectMode="Permanent"

              destinationUrl="http://maindomain/$1" />

    It works the way I want.

    The problem: Now if I try to open maindomain.com/umbraco/ , it is also redirecting to the maindomain.com rather than login page. I am not able to login.

    Is there any way I can solve this and get my login.aspx page to enter into??

    Please, reply any solution to this.

    Thank you,

    Sundip

  • sundip 76 posts 339 karma points
    Jan 24, 2013 @ 21:41
    sundip
    0

    Any help!!

  • Charles Afford 1163 posts 1709 karma points
    Jan 26, 2013 @ 21:07
    Charles Afford
    0

    Well its redirecting because you are hitting a .aspx page when you go to Umbraco/ are you not?  Well the easy way would just be to add another rule to say if anyone hits /umbraco page then do not redirect.  Not sure if this actually helps :/.  Charlie

     

  • Charles Afford 1163 posts 1709 karma points
    Jan 26, 2013 @ 21:09
    Charles Afford
    0

    So a a simple way would just be to catch /umbraco/ and then redirect it to /umbraco/  thus you are bypassing the first rule you have set up :)

  • sundip 76 posts 339 karma points
    Jan 28, 2013 @ 15:13
    sundip
    0

    Hey Charles,

    Thanks for the suggestion.

    I tried that and still it takes the first rule and redirect "www.maindomain.com/umbraco/login.aspx?redir=%2fumbraco%2f" to "www.maindomain.com".

    Means it removes the .aspx after login with the previous rule.

    If you have a sample of ignoring the previous rule than please share.

    Thank you,

    Sundip

  • Charles Afford 1163 posts 1709 karma points
    Jan 28, 2013 @ 20:26
    Charles Afford
    0

    Hey, i can have a look for you, i was hoping that because the second was more specfic that it would take that rule over the more general one.  

    Could you post the rule you wrote for it?  Thanks.  Charlie :).

  • sundip 76 posts 339 karma points
    Jan 29, 2013 @ 13:45
    sundip
    0

    I have the general rule as following and then I added for Umbraco login as you suggested, there might be the problem.

    Would you please correct if you have any idea.

    General rule:

    <add name=".aspx removal"
              redirect="Domain"
              ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
              virtualUrl="http://www.maindomain.com/(.*).aspx"
              redirectMode="Permanent"
              destinationUrl="http://www.maindomain.com/$1" />

    For Umbraco login:

    <add name=".aspx removal"
              redirect="Domain"
              ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
              virtualUrl="http://www.maindomain.com/umbraco/"
              redirectMode="Permanent"
              destinationUrl="http://www.maindomain.com/umbraco/login.aspx/redir=%2fumbraco%2f" />

    Thank you,

    Sundip

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Jan 29, 2013 @ 13:54
    Niels Jorck Ellegaard
    2

    We use the IIS redirect module so we can make rules in the web.config.

     

    This is what I have for stripping .aspx:

            <rule name="Trim aspx for directory URLs" stopProcessing="true">
              <match url="(.*)\.aspx$" />
              <conditions>
                <add input="{REQUEST_URI}" pattern="^/umbraco/" negate="true" />
              </conditions>
              <action type="Redirect" redirectType="Permanent" url="{R:1}" />
            </rule>

    This way you can easily setup conditions for your rules. You can do a lot of magic with it.

    Here you redirect to the url without .aspx, except if the request uri contains umbraco, then it doesn't do anything. Sounds like what you needed.

  • sundip 76 posts 339 karma points
    Jan 29, 2013 @ 14:11
    sundip
    100

    Hey Niels,

    Thank you very much. Your solution is perfect.

    In web.config it is showing me that 'system.webserver has invalid child element rewrite.....'. Why is that message?

    It works fine though, I am able to login in Umbraco..

    edit: 

    Sorry, I was trying to click your answer as solution. Is there any way to undo this??

    Thanks again,

    Sundip

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Jan 29, 2013 @ 14:16
    Niels Jorck Ellegaard
    1

    Hmm maybe your missing some elements in the XML.

    <system.webServer>
    <rewrite>
    <rules>
         
    <rulename="Trim aspx for directory URLs"stopProcessing="true">
             
    <matchurl="(.*)\.aspx$"/>
             
    <conditions>
               
    <addinput="{REQUEST_URI}"pattern="^/umbraco/"negate="true"/>
             
    </conditions>
             
    <actiontype="Redirect"redirectType="Permanent"url="{R:1}"/>
           
    </rule>
    </rules>
    </rewrite>
    </system.webServer> 

    It is purely speculation though. A quick search on google turned up with some XML schema that might be a bit wonky. So can't really say for sure.
    http://stackoverflow.com/questions/9280803/element-system-webserver-has-invalid-child-element-rewrite-should-i-fix-thi ;

  • Charles Afford 1163 posts 1709 karma points
    Jan 29, 2013 @ 14:49
    Charles Afford
    0

    That seems like a better implimentation :).  Thats the same sort of thing you would do in sitecore.  Thanks Niels

  • sundip 76 posts 339 karma points
    Jan 29, 2013 @ 15:44
    sundip
    0

    Hey Niels,

    I wrote the same thing. It's working fine.

    I will try to resolve that error message in web.config.

    Thank you so much for help Niels and Charles.

     

     

Please Sign in or register to post replies

Write your reply to:

Draft