Copied to clipboard

Flag this post as spam?

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


  • Jeppe Ladefoged 15 posts 65 karma points
    Nov 19, 2014 @ 11:02
    Jeppe Ladefoged
    0

    301 redirect: asp to aspx

    Hi,

    Tried a pletera of different approches on how to 301-redirect an old ".asp" based site to the clients new Umbraco site. Nothing seems to do the trick.

    Old contact page: http://www.nssas.dk/Default.asp?ID=7

    New contact page: http://www.nssas.dk/kontakt-os.aspx

    Thought this would do the trick (Returns 404 on asp pages):

    <add name="301ReDirect1" redirectMode="Permanent" redirect="Domain" ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
    virtualUrl="http://www.nssas.dk/Default.asp?ID=7"
    destinationUrl="http://www.nssas.dk/kontakt-os.aspx" />
    

    Tried adding ASP to ASPX rewrite (Returns 404 on .aspx pages):

    <add name="aspewrite"
     virtualUrl="^~/(.*).asp"
     rewriteUrlParameter="ExcludeFromClientQueryString"                 
     destinationUrl="~/$1.aspx"
     ignoreCase="true" />
    

    Also tried installing 301 URL Tracker but unfortunately that completely broke the site/installation.

    Any help will be greatly appreciated.

    Thanks in advance

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Nov 19, 2014 @ 11:42
    Stefan Kip
    0

    I'd recommend the 301 Url Tracker, because I've built it and it has been built exactly for these situations :-P

    Tell me, what happened when you installed the Url Tracker? It would've been nice if you reported the bug to me...

  • Jeppe Ladefoged 15 posts 65 karma points
    Nov 19, 2014 @ 11:56
    Jeppe Ladefoged
    0

    Thanks for your suggestion regaring 301 URL Tracker - the site launched today and i can't risk breaking it.

    I simply installed 301 URL tracker (Webdeploy / Umbraco 6.2.2 / simple database setup) and was completely shut out of Umbraco backend/frontend. Had to manually delete the package/dependancies via FTP to get the site up and running again.

    I would be happy to help you troubleshoot on an upcoming project. I have a project coming up in the next month where your package could help. I that case i would need support/assistance from you in case things go south. Let me know if we should pursue this.

    BR Jeppe / Leanback.dk

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Nov 19, 2014 @ 12:00
    Stefan Kip
    0

    In the end you should never do anything to your production environment without having at least tested it on your development environment first ;-)

    Too bad you didn't make a screenshot of the error or something like that.

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Nov 19, 2014 @ 12:05
    Stefan Kip
    0

    Totally forgot to reply to your original question!
    I use this for removing '.aspx':

    <!-- SEO | Trim .aspx for directory URLs -->
    <!-- Note: using UrlRewriting.Net because IIS UrlRewriting doesn't like rules with .aspx in it -->
    <add name="SEO | Trim .aspx for directory URLs"
        redirect="Application"
        redirectMode="Permanent"
        virtualUrl="^/(?![0-9]+.aspx)(?!umbraco/)([^\?]*?).aspx$"
        rewriteUrlParameter="ExcludeFromClientQueryString"
        destinationUrl="/$1/"
        ignoreCase="true" />
    

    So I guess something like this should work:

    <add name="Redirect asp to aspx"
        redirect="Application"
        redirectMode="Permanent"
        virtualUrl="^/([^\?]*?)\.asp$"
        rewriteUrlParameter="ExcludeFromClientQueryString"
        destinationUrl="/$1.aspx"
        ignoreCase="true" />
    
  • Jeppe Ladefoged 15 posts 65 karma points
    Nov 19, 2014 @ 12:37
    Jeppe Ladefoged
    0

    Thanks for your suggestions, i already tried that rewrite unfortunately. For some reason i does not work and still results in a 404 when i enter an "old" URL - eg. http://www.nssas.dk/Default.asp?ID=7

  • Jeppe Ladefoged 15 posts 65 karma points
    Nov 20, 2014 @ 14:24
    Jeppe Ladefoged
    0

    Ok, so i got a proper 301 for the old asp pages using the below rewrite.

    <add name="301RedirectDirUrlsOldSite" 
    virtualUrl="^http\://www.nssas.dk/Default.asp(.*)" 
    rewriteUrlParameter="ExcludeFromClientQueryString" 
    destinationUrl="http://www.nssas.dk/" 
    redirect="Domain" 
    redirectMode="Permanent" 
    ignoreCase="true" />
    

    Now all i need to do rewrite the resulting URLs eg. http://www.nssas.dk/?ID=7 (The below unfortunately does not work.)

    <add name="301ReDirect8" 
    redirectMode="Permanent" 
    redirect="Application" 
    ignoreCase="true" 
    rewriteUrlParameter="IncludeQueryStringForRewrite" 
    virtualUrl="http://www.nssas.dk/?ID=7" 
    destinationUrl="http://www.nssas.dk/kontakt-os.aspx" />
    

    Any tips on how to 301-redirect http://www.nssas.dk/?ID=7 to http://www.nssas.dk/kontakt-os.aspx this URL?

    Thanks again

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Nov 20, 2014 @ 14:46
    Stefan Kip
    0

    I'd use IIS Url Rewrite, much better than UrlRewriting.NET IMO...

  • Jeppe Ladefoged 15 posts 65 karma points
    Nov 20, 2014 @ 15:09
    Jeppe Ladefoged
    0

    Thanks, but i don't have that option unfortunately. I need to implement the 301's via UrlRewriting.config

Please Sign in or register to post replies

Write your reply to:

Draft