Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 939 posts 2574 karma points
    Jun 24, 2011 @ 08:37
    Claushingebjerg
    0

    urlrewriting .co to .com

    Hi

    Im using urlrewriting to 301 redirect multiple domains to on main domain. Works like a charm except for one domain... .co

    <add name="co"  
    virtualUrl="http\://www.mysite.co" 
    rewriteUrlParameter="ExcludeFromClientQueryString" 
    destinationUrl="http://mysite.com" 
    redirect="Domain" 
    redirectMode="Permanent" 
    ignoreCase="true" />

     

    This redirect causes the site to crash with too many redirects... I guess it must be some wild card thing with .co and .com... But how do i fix it?

    Thanks

  • David Verberckmoes 46 posts 77 karma points
    Jun 24, 2011 @ 08:50
    David Verberckmoes
    0

    Hi,

    Try to use this value: virtualUrl="http\://www.mysite.co$"

    The $ in a regex marks the end of a search pattern.

    /David

  • Claushingebjerg 939 posts 2574 karma points
    Jun 24, 2011 @ 09:31
    Claushingebjerg
    0

    hmmmm that doesnt seem to do anything

  • David Verberckmoes 46 posts 77 karma points
    Jun 24, 2011 @ 09:36
    David Verberckmoes
    0

    Did you do an app / apppool restart, don't remember wether the file gets loaded again on changes.

  • Claushingebjerg 939 posts 2574 karma points
    Jun 24, 2011 @ 09:39
    Claushingebjerg
    0

    It does, cause im testing on it right now with other things, and those changes get loaded 

  • David Verberckmoes 46 posts 77 karma points
    Jun 24, 2011 @ 09:44
    David Verberckmoes
    0

    And what happens when you add a trailing "/"

    virtualUrl="http\://www.mysite.co/"

  • Richard 146 posts 168 karma points
    Jun 24, 2011 @ 11:23
    Richard
    0

    I suggest trying:

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

    This will keep the text after the slash, e.g. /news, and append to the .com URL, and it should stop the matching of .com to this rewrite rule.

Please Sign in or register to post replies

Write your reply to:

Draft