i have a script named profile.php which will be a template for users info. so i post a basic template of it:
- Code: Select all
<?php
if (isset($_GET['username']) === true && empty($_GET['username']) === false) {
$username = $_GET['username'];
echo $username;
} else {
header('Location: index.php');
exit();
}
?>
hmm so if i write in URL for example: http://localhost/profile.php?username=test it echo in a browser name: test.
so i would like to short this URL to: http://localhost/test and for this i would like to use an .htaccess file. i was looking for something with no success! but i thing the .htaccess file shoul be something in this way:
- Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /profile.php?username=$1
don't work! so any clue? plese help


