[Catalyst] website member urls

Merlyn Kline merlyn at zynet.net
Thu Apr 30 11:38:07 GMT 2009


        It could be also helpful if we could find a way to create urls like

        http://user.hostname.com/

        dynamicly as Google blogger site does.
    We do this with a wildcard A record in the DNS and an Apache URL
rewriting rule that moves the hostname into the path. When I started writing
my app (in Catalytic pre-history) there wasn't any support (that I could
see) in Catalyst for using the hostname in the rules that decide when an
action is invoked and what parameters to pass to it. Things have moved on a
lot since then though so perhaps the URL rewriter could be replaced with a
better action description now.
    Merlyn

     If others don't know more about a newer and better way as you
suggested, can you give some hints about the way you told about?
It's pretty simple. The wildcard A record in the DNS just makes sure that
all requests for http://<anything>.ourdomain.com/ are sent to the server.
The Apache URL rewriter goes in the Apache config file and is basically a
piece of code, typically like a perl s/// regexp, that hacks the URL up a
bit so that, for example, http://anything.ourdomain.com/path might be
presented to the back end as http://ourdomain.com/ouraction/anything/path or
whatever suits you. See
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html for more info on
Apache URL rewriting.

The idea I had about Catalyst supporting this more directly was just that
there might be something like the PathPart() thing that would so something
similar with the hostname so you could say something like:

  sub handler : Chained('/') HostPart(something) CaptureArgs(1) {}

but from what J.Shirley said in another message it sounds like there is no
such thing. I'm afraid that's all a bit beyond me though - all my Catalyst
apps were started before the introduction of PathPart() and getting up to
date is still on my job list...

Merlyn


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090430/55ae5=
405/attachment.htm


More information about the Catalyst mailing list