Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
PerlMonks "/~username/" to "/?node=username" mod_rewrite magic

by jbisbee (Pilgrim)
on Nov 05, 2004 at 09:13 UTC ( #405438=monkdiscuss: print w/replies, xml ) Need Help??

Just wondering if anyone is opposed to suggesting we add a mod_rewrite rule to rewrite


so we can have can have ~usernames like and I'm not s RewrtieRule master, but I'm pretty sure it wouldn look something like this...

RewriteEngine on RewriteRule "^/~([^./]*)" "/?node=$1" [PT]
Sorry if this was suggested before and shot down.


Replies are listed 'Best First'.
Re: "/~username/" to "/?node=username" mod_rewrite magic
by radiantmatrix (Parson) on Nov 05, 2004 at 19:43 UTC

    I support this idea from a "maintainability" standpoint. I'd love to advertise my home node outside the Monestary. However, since the '?node=' notation is (a)ugly, and (b)could possibly change someday, it seems like a nifty idea to have a home-node URL like /~username that won't ever change.

    The only issue I'd have with implementing this, is that it would seem a silly thing to do if mod_rewrite isn't already installed, or if there's nothing else we'd use it for.

    But it isn't hard to imagine other things to use mod_rewrite for:

    • Section -> node_id mapping; e.g. /poetry => /?node=Perl Poetry
    • /inbox -> Message Inbox

    Those are off the top of my head, but I'm sure it would be easy to come up with other "good shortcuts" that mod_rewrite would help with.

    Of course, it isn't important to add such a feature, as the site is quite usable without it. But it would be nifty. ;-)

    require General::Disclaimer;
    "Users are evil. All users are evil. Do not trust them. Perl specifically offers the -T switch because it knows users are evil." - japhy

      However, since the '?node=' notation is (a)ugly, and (b)could possibly change someday,

      Regarding B): while I suppose there is a remote possibility of the node= notation changing (there is also a possibility that I will win the lottery on the same day I meet and marry a super model) I can assure you there is absolutely no possibility that the node_id=XXXX style of linking ceases to function as long as the site is running.

      Point A) I can't help you with :-)


Re: "/~username/" to "/?node=username" mod_rewrite magic
by PodMaster (Abbot) on Nov 05, 2004 at 11:38 UTC
    That should have a ;type=user at the end

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: "/~username/" to "/?node=username" mod_rewrite magic
by grinder (Bishop) on Nov 05, 2004 at 14:13 UTC

    I for one don't really see the use. I know my node number off by heart (29008). And my use.perl id is 1100 (which pleases my binary heart). On the other hand, I would love to see some rewrite magic to allow...

    ... to take me to my homenode. But even then I don't think it matters much any more. Most reputable search engines these days know how to navigate dynamic sites "beyond the ?" so that is no longer an issue. All that's left is the convenience of hacking the URL. And the above rewrite would make that easier, but it's of no great importance.

    - another intruder with the mooring of the heat of the Perl

      I agree, its not important, but it is simple and easy to do. Just wondering if anyone had a valid objection of why we shouldn't do it :)


Re: "/~username/" to "/?node=username" mod_rewrite magic
by ysth (Canon) on Nov 07, 2004 at 05:44 UTC
    If someone went to the trouble of doing this, I'd make it go ahead and change every /foo to /?node=foo, with perhaps a special case that /~bar would become /?node=bar;type=user. Oh, and I guess (and any other real files out there, if any) would be left alone.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://405438]
Approved by Arunbear
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2020-10-20 07:03 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (209 votes). Check out past polls.