Reputation: 4979
i got a Q regarding mod_rewrite with php.
currently my userprofile php page has the following link to determine a user: domain.com?username=john
i would need to convert this url into like this: domain.com/john.
how can i do this in mod_rewrite??
Upvotes: 0
Views: 145
Reputation: 7131
Something like:
RewriteEngine On
RewriteRule ^domain.com/(.*)$ domain.com/profile.php?username=$1
Upvotes: 2
Reputation: 4979
I found the solution. The initial problem was my profile php page has the following link: domain.com/profile.php?username=john
instead of this, i would need to make it easy to read url like this: domain.com/john.
what i did is:
RewriteEngine On
RewriteRule ^([^/\.]+)/?$ /profile.php?username=$1 [L]
I'm not sure if this has any security breach but do leave your feedback
Upvotes: 0