The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Mod rewrite username forwarder
I would like to have a hack that allows users to view other users profiles by typing http://www.mydomain.com/username which forwards to member.php?u=23 or whatever. ive been told you can do this with mod rewrite, any1 care to have a go
|
#2
|
||||
|
||||
One way for a basic mod_rewrite of the members section: in your .htaccess, you need the following
Code:
RewriteEngine on Options +FollowSymLinks RewriteRule ^member([0-9]+).html$ member.php?u=$1 [L] This said, it is doable to have a cached htaccess that is updated via a daily cron job based on the userlist, but it would make for high server overhead having a N-line htaccess file where N in the number of members you have... |
#3
|
|||
|
|||
Quote:
https://vborg.vbsupport.ru/memberlis...username=Natch which will give you names like Natch. If you want names exactly matching Natch, you'd just need to hack memberlist.php slightly: above Code:
if ($ausername) { $condition .= " AND username LIKE '%" . addslashes_like(htmlspecialchars_uni($ausername)) . "%' "; } Code:
if ($myusername) { $condition .= " AND username = '" . "htmlspecialchars_uni($myusername)" . "' "; } Also: You've probably noticed that in the admin panel if you do a user search and there is only one result it goes right to that user. It shouldn't be too hard to get that to happen in memberlist.php too. Regards, Matt |
#4
|
||||
|
||||
I had a chat with a mod_rewrite expert last night at my local PHP User Group meeting: suggestion from there was to write a small redirect script (uanmeparse.php) to parse the username to userid, then redirect to forumhome/member.php?u=$userid, and then mod_rewrite like so:
Code:
RewriteEngine on Options +FollowSymLinks RewriteRule ^~([a-z0-9]*)$ unameparse.php?un=$1 [L,NC] |
#5
|
||||
|
||||
Quote:
|
#6
|
||||
|
||||
Quote:
|
#7
|
||||
|
||||
Seems sloppy to me Zachery: a 404 used for something other than an actually missing page is against the HTML spec, and some proxy servers will simply serve up an ISP specific custom 404 page, rather than follow the script's directive, on getting the 404 HTML header.
|
#8
|
|||
|
|||
Quote:
Regards, Matt |
#9
|
||||
|
||||
Not for long...
|
#10
|
|||
|
|||
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|