i am creating a website that handle a profile page and i need to get the username from the URL until this point all work fine but i am having a problem with using the .htaccess and i do not know how to fix this error this is my first time to use the .htaccess i am using the WAMP package and the browser give me this error after i add the .htaccess file and it hide the folder that contain it.
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at admin@localhost to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. this is a part of the profile.php
profile.php
// updatede for using the GET methode for ge the data nedded from the url
if(isset($_GET['u']))
{
$username = mysql_real_escape_string($_GET['u']);
if(ctype_alnum($username))
{
//check user exist
$check = mysql_query("SELECT user_name, first_name FROM user WHERE user_name = '$username' ")or die(mysql_error());
if (mysql_num_rows($check)==1)
{
$get = mysql_fetch_assoc($check);
$username = $get['user_name'];
$fname = $get['first_name'];
}
else
{
echo "<h2>User does not Exist!!</h2>";
exit();
}
}
}
echo "$username";
?>
.htaccess
RewriteEngine On
RewriteRule^([a-zA-Z0-9_-]+)$ profile.php?u=$1
RewriteRule^([a-zA-Z0-9_-]+)/$ profile.php?u=$1