Copied to clipboard

Flag this post as spam?

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


  • Denis 47 posts 68 karma points
    Aug 05, 2012 @ 09:22
    Denis
    0

    UrlRewriting 301 asp 4.0 .html .php

    Hello,

    please help, i need to do url permanent 301 redirecting .php and .html url-s to asp new pages like  /home/

    www.mysite.com/about-us.html to www.mysite.com/about-us/ 

    www.mysite.com/otherpages.html to www.mysite.com/error-404/ 

    www.mysite.com/catalog.php to www.mysite.com/catalog/

    i see that  umbraco only works with aspx pages, please how to do this ?

    my sites are on iis7 ASP 4.0 STANDARD ( NOT INTEGRETED PIPELINE, this mode not working at all)

    Please suggest !

  • Paul Blair 466 posts 731 karma points
    Aug 05, 2012 @ 12:54
    Paul Blair
    0

    The first tip I have is that while developing the rewrites don't use permanent redirects (i.e. use temporary until everything is working correctly) as your browser will cache permanent redirects.

    Something like this might do the trick:

        <add name="Redir"

             virtualUrl="(.*)://www.mysite.com/(about-us|catalog).(html|php)"

             rewriteUrlParameter="IncludeQueryStringForRewrite"

             destinationUrl="$1://www.mysite.com/$2/"

             ignoreCase="true"

             redirect="Domain"

             redirectMode="Permanent" />

    I'm not sure what you want to achieve with the 404. You could also try "/(*).(html|php)" for the rewrite rule - everything will then try to get to a page and if 1 does not exist the standard 404 will be used.

  • Denis 47 posts 68 karma points
    Aug 05, 2012 @ 14:06
    Denis
    0

    Now, old site have top positions by some keywords with old pages .html an some .php

    i have try to do this, but in ASP 4.0 standard mode .html redirections are not working, so i have then setup INTEGRETED PIPELINE, but in this mode redirections are working, but it seams somthing is not workig well with clientdependency and can not open .cshtml file form developer editor

    i was setup url rewriting like this 

        <add name="ToWww"  
          virtualUrl="^http\://mysite.com/(.*)"
          destinationUrl="http://mysite.com/$1"
          redirectMode="Permanent"
          redirect="Domain"
          ignoreCase="true"
          rewriteUrlParameter="IncludeQueryStringForRewrite" />

    first i have redirect IMPORTANT pages

        <add name="goToServices" 
          virtualUrl="/services.html" 
          destinationUrl="/services/" 
          redirectMode="Permanent" 
          redirect="Domain" 
          ignoreCase="true" 
          rewriteUrlParameter="IncludeQueryStringForRewrite"  />

        <add name="goToCatalog" 
          virtualUrl="/catalog.php" 
          destinationUrl="/catalog/" 
          redirectMode="Permanent" 
          redirect="Domain" 
          ignoreCase="true" 

          rewriteUrlParameter="IncludeQueryStringForRewrite"  />    

    then NOT IMPORTANT to 404    

        <add name="goHtmlNotUsefulTo404"
           redirect="Domain"
           ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
           virtualUrl="/(.*).html"
           redirectMode="Permanent"
           destinationUrl="/error-404/" />
        
        <add name="goPhpNotUsefulTo404"
           redirect="Domain"
           ignoreCase="true" rewriteUrlParameter="ExcludeFromClientQueryString"
           virtualUrl="/(.*).php"
           redirectMode="Permanent"
           destinationUrl="/error-404/" />  

    i did not know that there is problems with permanent redirects...

    most important thing is that i want to keep google ranked and indexed pages

    i have posted before question about asp mode, IN INTEGRETED MODE SOME BACKEND FUNCTIONS ARE NOT WORKING, IN STANDARD MODE CAN NOT BYPASS IIS 404 ERRORS AND DO .HTML AND .PHP REDIRECTIONS

  • Denis 47 posts 68 karma points
    Aug 05, 2012 @ 14:29
    Denis
    0

    What iis settings you using, version, mode in this case ?

    And is it this in urlRewirite.config or in web.config ? 

    <add name="Redir"

             virtualUrl="(.*)://www.mysite.com/(about-us|catalog).(html|php)"

             rewriteUrlParameter="IncludeQueryStringForRewrite"

             destinationUrl="$1://www.mysite.com/$2/"

             ignoreCase="true"

             redirect="Domain"

             redirectMode="Permanent" />

    Thank You

  • Denis 47 posts 68 karma points
    Aug 05, 2012 @ 15:55
    Denis
    0

    i have found solution, it is workint via <rewrite> and web.config ...

    thank You for tip about temporary :-)

Please Sign in or register to post replies

Write your reply to:

Draft