Create event before site loads
Off the top of my head and in no way tested or thought through, you could put some logic in your plugin's init() method:

public function init()
{
    $username = craft()-&gt;request-&gt;getQuery('username');

    if ($username)
    {
        craft()-&gt;urlManager-&gt;setRouteVariables(array(
            'username' =&gt; $username
        ));

        craft()-&gt;runController('myPluginHandle/myPluginActionMethod');
    }
}


Then in your plugins's controller:

class MyPluginController extends BaseController
{
    protected $allowAnonymous = true;

    public function actionDoIt($username)
    {
        // Do your thing.

        $this-&gt;redirect('homepage');
    }
}