Currently i have url parameters like this http://www.website.com/index.php?user&page=edit
And in index.php i have set if $_GET['user'] is set display user’s page and inside user’s page i have done something like if $_GET['page'] is set then find the page (in this case edit) and load that page.
It works well.,
But what changes do i need to make in htaccess file such that the url’s become like this http://www.website.com/user/ - to load user file and http://www.website.com/user/edit - to load user edit file
Here’s my htaccess file content
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)/$ index.php?$1
RewriteRule ^(.*)/(.*)/$ index.php?$1&page=$2
But this doesn’t seem to work the way i expected.
If i load http://www.website.com/user/edit - it works but if i just load /user/ - it doesn't
Try switching both rules and adding the
L-flag:.*matches every character sequence. That means thatuser/edit/is matched as well asuser/. You need to place the more specific rule first, to make sure that there is a/in between. I suggest that you change that rules to something like this, since the other rules might match stuff that you did not intend:[^/]+will match every sequence that does not contain any/.