Shorter Profile Url
by
24 Dec 2007
Rating: (2 votes
- 4.00 average)
What does it do? It produces a short profile url like so: yourdomain.com/username Do you guarantee it will work on my server? No. Will you support this if I cannot get it to work for me? I cannot guarantee this will work for everyone and therefor I will not support this. Will this work with usernames that have special characters or spaces in them? I don't know. I have only tested it on my test forum with a few usernames that don't have special characters or spaces in them. If it works for you, please let others know. How can I tell my members about the shorter profile url? That is something you will need to figure out. Or view my update post here to show it in their profiles: Spoiler (click to open)
Here is the code I'm currently using (I have other stuff in it but this will pertain to this article):
Code:
Options +FollowSymLinks RewriteEngine on RewriteRule ^$ index.php RewriteRule (^[-_A-Za-z0-9\ ]*$) member.php?&username=$1 If you are using 3.7.0 beta 4 and want to change the url in member profiles to reflect their new profile url so they know what it is... Edit the template "memberinfo_block_contactinfo" and find this code: Code:
<dd><a href="$prepared[profileurl]">$prepared[profileurl]</a></dd> Code:
<dd><a href="http://www.yoursite.com/$userinfo[username]">http://www.yoursite.com/$userinfo[username]</a></dd> Close
If this does not work for me, can you suggest another one? VBseo Zoints Nuhit.com Insert the following code in your .htaccess file (You might want to read the whole thread for other code examples that might work best for you): Code:
RewriteEngine on RewriteRule ^/?([a-zA-Z0-9]+)$ member.php?username=$1 [L] Credits/References: http://www.sitepoint.com/print/apache-mod_rewrite-examples http://www.vbulletin.com/forum/index.php?t=242089 Zamurick X http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html |