Have been trying to work this out for some hours now but not getting it right.
I have a site www.example.com/user.php?username=john
I use .htaccess to make it pretty like so www.example.com/user/john
I use the following .htaccess Rewrite rule and it works
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ ./user.php?username=$1 [L]
The problem
I have a profile page like www.example.com/profile.php?username=john
I also use the following .htaccess to make it good looking like www.example.com/profile/john
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ ./profile.php?username=$1 [L]
Now, this doesn't work at all but when I remove the first rewrite rule (rule user.php) and place it after the second rewrite rule (rule profile.php) my profile page works, and vice versa,
So it's basically whatever rule I place first is what determines what page I can access with my URL.
I need it to work for both pages. I will agree with you am not close to a beginner level at .htaccess rewrite.
Thanks in advance.