Tutorial :.htaccess - Pretty User Profile URLs



Question:

I want to make my user profiles 'pretty' as it were. Here is the regular URL:

user.php?user=UserName

I want this to become:

user/Username

Please help :) Im a .htaccess newbie.


Solution:1

Try these directives:

RewriteEngine on  RewriteRule ^user/([^/]+)$ user.php?user=$1 [L,QSA]  

This rule rewrites any request with a URL path of the form /user/foobar internally to /user.php?user=foobar.


Solution:2

RewriteRule ^user/(.+)$ user.php?user=$1 [L,QSA]  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »