View Full Version : Redirect member.php
darkblade25
09-29-2008, 04:17 AM
I have shorter url for profile ex. http://www.mysite.com/Username
Is there a way to redirect the default member.php?u=1 to http://www.mysite.com/Username?
Dismounted
09-29-2008, 04:30 AM
Yes - by using a plugin to smartly do redirects based on URL.
darkblade25
09-29-2008, 04:46 AM
Not very good with plugin, but should I put the hook as global_start? Also how would the php code look, pseudocode is fine, just want to get an idea on how to do this.
Dismounted
09-29-2008, 04:57 AM
Plugin should be at member_execute_start, because anything before does not have the username fetched.
darkblade25
09-29-2008, 05:38 AM
Got it to work
$id = $vbulletin->input->clean_gpc('g', 'u', TYPE_INT);
if ($id)
{
$username = fetch_userinfo($id);
$vbulletin->url = $vbulletin->options['bburl'] . '/'.$userinfo['username'];
standard_redirect();
}
Dismounted
09-29-2008, 05:48 AM
You have to check that the URL is not already in the correct format - see the PHP server environment variables. Also, you do not need that conditional, you are already running the plugin only in member.php.
darkblade25
09-29-2008, 05:52 AM
Thanks, Dismounted. You were alot of help.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.