Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Rewrite Rule Not Working?

  • 25-06-2015 09:18AM
    #1
    Registered Users, Registered Users 2 Posts: 1,991 ✭✭✭


    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, Registered Users 2 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, Registered Users 2 Posts: 1,991 ✭✭✭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