Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Rewrite Rule Not Working?

Options
  • 25-06-2015 9:18am
    #1
    Registered Users Posts: 1,987 ✭✭✭


    Having a slight issue getting a rewrite rule to work, the first rewrite rule works fine but the second one isn't doing anything, the first rule is always applied, from what I can see the syntax is correct, could it be the ampersand in the second rule between the `$2` and `$3` values?

    URL:
    /activate/?e=testemail@localhost.com&c=123456
    

    Rules:
    RewriteRule ^/([^/]*)/$ /activate.php?sa=$1 [L]
    RewriteRule ^/([^/]*)/?e=([^/]*)&c=([^/]*)$ /activate.php?sa=$1&e=$2&c=$3 [NC,L]
    


Comments

  • Registered Users Posts: 1,206 ✭✭✭zig


    Ziycon wrote: »
    Having a slight issue getting a rewrite rule to work, the first rewrite rule works fine but the second one isn't doing anything, the first rule is always applied, from what I can see the syntax is correct, could it be the ampersand in the second rule between the `$2` and `$3` values?

    URL:
    /activate/?e=testemail@localhost.com&c=123456
    

    Rules:
    RewriteRule ^/([^/]*)/$ /activate.php?sa=$1 [L]
    RewriteRule ^/([^/]*)/?e=([^/]*)&c=([^/]*)$ /activate.php?sa=$1&e=$2&c=$3 [NC,L]
    

    I had a similar problem here, it might help...

    http://stackoverflow.com/questions/30864997/htaccess-query-string-redirect-not-working-correctly


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Tired using the query string to resolve the problem but doesn't seem to be working, I'm pretty sure I've got it the wrong way around!?
    RewriteCond %{QUERY_STRING} ^sa=([^/]*)&e=([^/]*)&c=([^/]*)$ [NC]
    RewriteRule ^/([^/]*)/?e=([^/]*)&c=([^/]*)$ /activate.php?sa=$1&e=$2&c=$3 [QSA,L]
    


Advertisement