Apache Redirect not working with a hyphen in the url

Discussion in 'Apache' started by tyler_durden, Oct 30, 2011.

  1. #1
    RewriteRule ^section1/page http://www.mysite.com/section2/page-new [R=301,L]
    Code (markup):
    This code does not work, it works without the hyphen in the "page-new" when I change it to a term without the hyphen. My browser shows:

    The page isn't redirecting properly
    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    Any advice?
     
    tyler_durden, Oct 30, 2011 IP
  2. Sorror

    Sorror Active Member

    Messages:
    376
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #2
    This line must be in conflict with some other one, creating an infinite 301 loop.

    You haven't marked the end of your pattern (^section1/page$), which may cause such conflicts, depending on what the other directives in your htaccess file are. The line by itself is not incorrect and works as it should.
     
    Sorror, Oct 30, 2011 IP
  3. tyler_durden

    tyler_durden Peon

    Messages:
    340
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    awesome, thanks for the $ tip, I did not know that should be used to end the pattern, adding it fixes this issue. I have hundreds of redirects, I will need to look into it further.
     
    tyler_durden, Oct 30, 2011 IP