Infinite loop occurring with redirect

Discussion in 'Apache' started by greenlizard, Apr 29, 2010.

  1. #1
    Hi,

    I'm wanting to redirect:

    http://sub.mysite.com/?rss=1

    to:

    http://sub.mysite.com/pages/rss

    This isn't working:
    Redirect 301 /?rss=1 http://sub.mysite.com/pages/rss

    I get an infinite loop. Maybe I need to use mod_rewrite instead of redirect?
     
    greenlizard, Apr 29, 2010 IP
  2. greenlizard

    greenlizard Guest

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    OK, I was wrong. It's not an infinite loop. It's just not redirecting at all. I'm just learning about .htaccess and after doing more research it's because of the question mark. I believe I have to do a combination of a redirect and a mod_rewrite?
     
    greenlizard, Apr 30, 2010 IP
  3. greenlizard

    greenlizard Guest

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I apologize for replying to my own thread but I found a solution.

    
    RewriteCond %{QUERY_STRING} ^rss=([0-9]*)$
    RewriteRule $ http://sub.mysite.com/pages/rss [R=302,L]
    
    Code (markup):
    That seems to work just fine.
     
    Last edited: Apr 30, 2010
    greenlizard, Apr 30, 2010 IP