I'm attempting to write this rewrite code also it just isn't working (apache 2.2):

RewriteEngine on
RewriteBase /

RewriteRule ^account/activate\?token=(.*) index.php?route=account/activate&token=$1

I attempted a variety of versions. After trying for around and hour and looking out google I'm stumped. This is when you are available in!

Do this

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^account/activate$ index.php?route=account/activate&%1

Essentially this maps the whole query string to %one in the RewriteRule and you will then access your token out of your php-script using traditional regular $_GET['token']

The pattern from the [cde] directive is just examined agains the URI path. The query string are only able to be examined using the [cde] directive:

RewriteRule

But there is a simpler solution: Just set the [cde] flag to obtain the query string instantly appended towards the new query string:

RewriteCond

Note: You need to simply set the RewriteCond %{QUERY_STRING} ^token=(.*) RewriteRule ^account/activate$ index.php?route=account/activate&token=%1 flag if there's a question defined within the substitution. Otherwise, the initial query already will instantly appended.

I have used this:

QSA

And delay pills work with this particular:

RewriteRule ^account/activate$ index.php?route=account/activate [QSA]

My directory where my code resides was known as test. They are my web addresses:

http://localhost:80/test/account/activate/?token=test
http://localhost:80/test/account/activate/?token=asd

You can't match the parameters a part of your URL with mod_rewrite.

The only method to test for parameter inside your URL is by using a RewriteCond directive and testing the env variable QUERY_STRING