locked
Url Rewriting links are not working properly RRS feed

  • Question

  • User-424706843 posted

    I'm using urlrewriter.net to rewrite my rules with the following rules in the web.config


        <rewriter>
            <rewrite url="~/en/(.*)" to="~/$1.aspx"/>
            <rewrite url="~/sv/(.*)" to="~/$1.aspx"/>
            <rewrite url="~/it/(.*)" to="~/$1.aspx"/>
        </rewriter>


        <rewriter>
            <rewrite url="~/en/(.*)" to="~/$1.aspx"/>
            <rewrite url="~/sv/(.*)" to="~/$1.aspx"/>
            <rewrite url="~/it/(.*)" to="~/$1.aspx"/>
        </rewriter>

    Besically I want to rewrite my page www.mysitename/my-tags-here.aspx to www.mysitename/en/my-tags-here

    This is working ok, but if I am in www.mysitename/en/my-tags-here and I click on my header defined in the master page as

        <div id="header">
        <asp:HyperLink ID="hplHeader" runat="server" meta:resourcekey="imgHeader"></asp:HyperLink>        
        </div>

    CODEBEHIND
            hplHeader.NavigateUrl = "~/" + Global.HOME_PAGE;
    

    It is not working properly and it is redirecting to www.mysitename/my-tags-here (without the en subfolder, losing the path structur).

    Is there any way I can avoid that in a simple way?

    Thanks



    Thursday, February 11, 2010 12:36 AM

All replies

  • User-861818263 posted

    whenever your you are rewriting you should register your ".*" with Worker process on IIS as for example u have rewrite URl with ".do"  then you have to add .do and attach worker process dll or exe with same extesion on IIS

    Thursday, February 11, 2010 4:17 AM
  • User-424706843 posted

    Thank you for your reply but sorry I don't get the meaning.

    The site is multilanguage so I want to have for each page that uses local/global resources three url rewriting like 

            <rewrite url="~/en/(.*)" to="~/$1.aspx"/>
    
            <rewrite url="~/sv/(.*)" to="~/$1.aspx"/>
    
            <rewrite url="~/it/(.*)" to="~/$1.aspx"/>

    So I will have google be able to index properly www.sitename.com/en/default.aspx,www.sitename.com/sv/default.aspx and www.sitename.com/it/default.aspx.

    I'm testing on my local VS 2008 and after I click on the header link that is defined in my master page (~/default.aspx) I am redirected to www.sitename.com/Default.aspx rather than www.sitename.com/en/default.aspx ad example

    Thursday, February 11, 2010 9:43 AM