I am trying to rewrite the URL of the users profile page to be more clean.
https://example.com/user/profile.php?user=username
to
https://example.com/username
I have looked around for a solution and read some documentation but I can't quite figure out how to get it right.
I have this code in my .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ user/profile.php?username=$1 [QSA,L]
When I run this code I get an internal server error each time but I ran my code through htaccesscheck.com and it said my syntax was all good. So I'm guessing that my problem stems from my lack of knowledge on htaccess.
I should also mention I have another RewriteRule to remove the .php extension from the URL. Not sure if this would affect anything, but if it would than I can follow up with my whole .htaccess file.
EDIT:
I did check error logs and I guess I should have put that here in the beginning, my bad. It outputted this:
RewriteRule: bad flag delimiters
Full .htaccess:
Options +Indexes
Options +MultiViews
IndexOptions FancyIndexing
IndexIgnore *
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^(.*)$ user/profile?username=$1 [QSA,L]