Back to vBulletin 3 Articles

Shorter Profile Url
by CallieJo 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
I just wanted to make note that you must use a trailing slash at the end of your links to directories or you will get an error message saying that user does not exist. For example, if you have a gallery and you link to it like yoursite.com/gallery then you will need to change the url in your navigation to yoursite.com/gallery/ so the mod rewrite doesn't treat it like a username. Check your navigation to all areas of your site once you've used the mod rewrite code.

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>
and change it to:
Code:
<dd><a href="http://www.yoursite.com/$userinfo[username]">http://www.yoursite.com/$userinfo[username]</a></dd>
You will need to change yoursite.com to that of your forum. So if your forum is yoursite.net/forum or forums.yoursite.org or whatever, then be sure to change it as so.

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

vblts.ru supports vBulletin®, 2022-2024