I need Help Please, not redirecting properly!

Discussion in 'Apache' started by web_junkie, Oct 26, 2008.

  1. #1
    Hi, I wanted to rewrite one of my url, from:

    mysite.com/results.php?category=12

    to

    mysite.com/chulucanas-pottery

    which I did successfully with the following code :

    RewriteRule ^chulucanas-pottery$ results.php?category=12

    but now I want to redirect all trafic that goes to

    mysite.com/results.php?category=12

    to go to

    mysite.com/chulucanas-potttery

    how can I do this , I try :

    RewriteCond %{QUERY_STRING} category=12
    RewriteRule ^results\.php$ chulucanas-pottery? [R=301,L]



    but it did not work, any suggestions?

    Thanks
     
    web_junkie, Oct 26, 2008 IP
  2. mortenb

    mortenb Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Something like this should work fine.

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^category=12$
    RewriteRule ^results\.php$ chulucanas-pottery [R=301,L]
     
    mortenb, Oct 26, 2008 IP
  3. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #3
    When you say "it doesn't work" what actually happens ?

    Does it just display the page without redirecting ?
    Does it redirect in an infinite loop ?
    Does it display a 500 error ?
     
    Ladadadada, Oct 26, 2008 IP
  4. aclmaps

    aclmaps Guest

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Have you checked into the idea of setting up a rewrite log to see what's happening?

    RewriteLogLevel 3
    RewriteLog /usr/local/apache/domlogs/yourdomain.com-rewrite

    I've not tried it but I believe you change change the rewrite log level up to 9 for full information.
     
    aclmaps, Oct 26, 2008 IP
  5. web_junkie

    web_junkie Active Member

    Messages:
    98
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #5
    Well first, thanks for the replies. I tried what morten suggested, but with a little variation at the end of the third line right before "[R=301,L]" (the question mark), as follows :

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^category=12$
    RewriteRule ^results\.php$ chulucanas-pottery? [R=301,L]
    RewriteRule ^chulucanas-pottery$ results.php?category=12

    with this code it rewrites the url and also redirects it but the page does not load it says:

    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 thoughts

    Thanks
     
    web_junkie, Oct 26, 2008 IP