How do I go about using Apache .htaccess to rewrite "example.com/user.php?username=test" to "example.com/user/test"?
I'm currently working with the following:
RewriteRule ^user/(.*)$ user.php?username=$1
But this seems to treat "user/" as a subfolder; it then appears to look for "$1" within it (which doesn't exist obviously) and then redirects me to "user/index.php".
Currently my .htaccess file looks like:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R,L]
This adds HTTPS, WWW and removes any trailing slash.
Any help would be great, thanks!