At the moment I am developing a website with user interaction. I could transform all of the usernames in links for the profile page with a file .htaccess that has the following commands:
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?u=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?u=$1
If I understand correctly, this code substitutes the "profile.php" for the argument after the signal "?" if the URL matches the regular expression. But I didn't understood how the "u=$1" accomplishes that because the "u" is not a variable session. This is my configuration in PHP for the session variables:
$_SESSION["id"] = $id;
$_SESSION["username"] = $username;
$_SESSION["password"] = $pswd;
$_SESSION["email"] = $email;
I would like to include too space in the regular expression, because at the moment only usernames like "FirstUser" are accepted, user names like "First User" give me an error at the browser.
When I add a space in the pattern I get the following HTTP 500 error: