I'm trying to redirect URLs from example.net/customname
or example.net/customname/
to example.net/my/home.php?username=customname . This in itself is not complicated:
RewriteRule ^([a-zA-Z0-9_-]+)$ my/home.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ my/home.php?username=$1
However, I want to exclude my existing directories and files, such as example.net/about/
and example.net/files
. I can't quite figure out how to use RewriteCond (do I need multiple rewrite conds?) in order to exclude items like example.net/about/
from being rewritten to example.net/home.php?username=about
. How can I do this?
Thank you!
EDIT: Here is the exact solution...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)/?$ my/home.php?url=$1 [NC,L]