Reputation:
I am very new to .htaccess just want to write one rule which is something like this:
http://www.example.com/profile.php?username=John.janorkar
Want to make it something like this:
http://www.example.com/profile/John.janorkar
I also want to redirect without www to www as below (below code is working fine just have problem with above one.
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
Can any expert help me please?
Upvotes: 1
Views: 109
Reputation: 785216
Just add this rule in your .htaccess:
RewriteRule ^profile/(.+)/?$ profile.php?username=$1 [L,NC,QSA]
Upvotes: 0