301 redirect issue

Discussion in 'Apache' started by MrX, Feb 13, 2007.

  1. #1
    I'm trying to do a 301 from one site to a specific folder on a different site, without automatically tacking on the rest of the URL. The problem is the redirect keeps appending the rest of the URL to the new site. This happens whether I do the redirect through htaccess or a php Location redirect. Any help would be appreciated.

    What I want: www.site.com/* -> www.site2.com/specific_folder/
    What happens: www.site.com/* -> www.site2.com/specific_folder/*
     
    MrX, Feb 13, 2007 IP
  2. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What rewriterule do have you currently? The query string will always be passed on if you don't manually alter it in the destination of the rule, so if you're using dynamic URLs this could be the problem. To stop the query string being passed you need to overwrite it by including ? in the destination.

    RewriteRule .* http://www.site2.com/specific_folder/? [R=301]
    Code (markup):
     
    rodney88, Feb 14, 2007 IP
    MrX likes this.
  3. MrX

    MrX Well-Known Member

    Messages:
    1,563
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    140
    #3
    That's exactly what I was missing...the '?'. Rep 4 u. Thx!
     
    MrX, Feb 14, 2007 IP