I'm having issues with my rewriterule and directory index
DirectoryIndex invite.php about.php account.php
RewriteRule ^/?([a-z0-9_-]+)/?$ /user.php?u=$1 [L]
Lets say about.php
is in the about folder. When i go to www.url.com/about/about.php, it works fine. But when I go to www.url.com/about/
, it goes to my user.php
page. When I go to www.url.com/about
, (without ending slash), it goes to www.url/about/?u=about
Can anyone help me?
At the same time, I'm trying to set up where user can go to www.url.com/andrewliu
instead of www.url.com/user.php?u=andrewliu
I guess I need to somehow fix my ending slash and the redirect?
Thanks!
EDIT
I have this
DirectoryIndex invite.php about.php account.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^/?([a-z0-9_-]+)/?$ /user.php?u=$1 [L]
RewriteCond %{QUERY_STRING} !^b= [NC]
RewriteRule ^(business)/(.*)$ /$1/index.php?b=$2 [L,NC,QSA]