Redirect to profile with htaccess: Revision

Last updated by Jeroen Dalsem

Ever wanted to use the next url?

yourdomain.com/username

It would be better than yourdomain.com/pg/profile/username.

You can make it happen by editing your .htaccess file.
At the bottom of the file you find the <IfModule mod_rewrite.c> section.
Add at the end of this section the next line

RewriteRule ^([A-Za-z0-9\_\-]+)$ http://%{HTTP_HOST}/pg/profile/$1 [R]

Now you can access your profile with a short url

Jeroen Dalsem

Owner of ColdTrick IT Solutions, developing social networking sites for the dutch market

History