I am a beginner in .htaccess can any one help me with this?
//my .htaccess code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /alumini/profile.php?username=$1
//with the above i can redirct the url
localhost/alumini/profile.php?username=name
to
localhost/alumini/name
but i also want to hide loacalhost/alumini/index.php to loacalhost/alumini
in simple ….
i want an htaccess code to hide the index page also i need to convert
localhost/alumini/profile.php?username=name
to
localhost/alumini/name
Your first request is a rewrite, not a redirect. Your second is a redirect. For the re-write, the following rule should do the trick (untested):
The regular expression inside the brackets matches one or more upper or lowercase letters and nothing else, and the value of the match is passed to $1. You may need to change the regular expression depending on the format of your usernames.
and for the index.php redirect (to remove the index.php where it exists):
The 301 represents the fact that the page has moved permanently, and is better for SEO as only the non index.php page will be indexed.