Reputation: 1193
In my site there is a membershp system. Users' profile page likes profile.php?u=username
I want to show url like http://sitename.com/username
So I wrote in .htaccess
RewriteRule ^profile profile.php [L]
RewriteRule ^([^/]*)$ profile.php?u=$1 [L]
When you go to http://sitename.com/profile
, the page shows general information about system. And http://sitename.com/username
shows username profile. But When I want to go http://sitename.com
, http://sitename.com/profile
psgr show, the index.page (main page) not shown. How can I do it?
Upvotes: 1
Views: 104
Reputation: 785128
Keep your .htaccess like this:
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteRule ^profile/?$ profile.php [L]
RewriteRule ^ads/?$ advertisement.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ profile.php?u=$1 [L,QSA]
Upvotes: 2