I have a registration and activation code that I am updating a bit, after the user registers it sends them a email to activate.
Link emailed
/user/activate/$hashed_confirm_code
which generates
http://example.com/user/activate/0dbc0aef3d4d9d3e67ee4bf6c
I went to http://www.visiospark.com/mod-rewrite-rule-generator/ and did a mod rewrite changed the email link accordingly.
rewrite is on
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]
RewriteCond %{QUERY_STRING} (^|&)hash_token=($|&)
RewriteRule ^user/activate$ /user/activate/?&%{QUERY_STRING}
if i click the link it produces the following in the browser
http://example.com/user/activate/0dbc0aef3d4d9d3e67ee4bf6c
however it just gives a 500 error, the basics of my activation code function is
function activate_user(){
if (($_SERVER['REQUEST_METHOD'] === "GET") && isset($_SERVER['QUERY_STRING'])) {
$confirm_code = $_SERVER['QUERY_STRING'];
//do stuff
}
}
now if i change the link in the browser
example.com/user/activate/0dbc0aef3d4d9d3e67ee4bf6c93c
to this
example.com/user/activate?0dbc0aef3d4d9d3e67ee4bf6c
it works, so if i remove the forward slash and add the question mark it works