Thank you everyone! Finally.

Wikus van de Merew your a genius.

The following routes does it, and if you try to access
example.com/dashboard you get a 404.

The only change I needed to make was to wildcard the GET/POST at the end.

routes_in = (

        ('.*:/favicon.ico', '/init/static/favicon.ico'),
        ('.*:/robots.txt', '/init/static/robots.txt'),
        ('.*:https?://dashboard\.example\.com:.* /(.*)', r'/init/dashboard/\2'),

        ('^/admin(?P<any>.*)', '/admin\g<any>'),
        ('^/appadmin(?P<any>.*)', '/init/appadmin\g<any>'),
        ('^/(?P<any>.*)', '/init/public/\g<any>'),

)

routes_out = (
        ('/init/dashboard/(?P<any>.*)', '/\g<any>'),
)

This makes me extremely happy (because it makes my boss happy)

-Thadeus





On Wed, Feb 17, 2010 at 10:33 AM, Jonathan Lundell <jlund...@pobox.com> wrote:
> On Feb 16, 2010, at 10:38 PM, Thadeus Burgess wrote:
>
>> example.com/controllerA/function1 -> /init/controllerA/function1
>> example.com/controllerA/function2 -> /init/controllerA/function2
>> example.com/controllerB/function1 -> /init/controllerB/function1
>> example.com/controllerB/function2 -> /init/controllerB/function2
>> example.com/$anything -> /init/defaultController/$anything
>> dashboard.example.com/function1 -> /init/dashboard/function1
>> dashboard.example.com/function2 -> /init/dashboard/function2
>> dashboard.example.com/$anything -> /init/dashboard/$anything
>>
>> Any of the above URLS should work.
>>
>> You should NOT be able to do the following, dashboard controller
>> should only be accessed by this single subdomain.
>>
>> !example.com/init/dashboard/function1
>>
>> I don't care if I have to declare every controller in routes... I
>> would have to do that in django/werkzeug/ruby/php/etc. I'm ready for
>> web2py to get out of my way and let me do what I want to do.
>>
>> When I said rewrite hostname I ment to redirect a single hostname to a
>> single web2py controller. This is the same concept as example1.com
>> goes to app1 and example2.com goes to app2, but on the controller
>> level instead of app level! (because the controllers share models)
>>
>> Hopefully this gets my point across.
>
> Would you repost the routes.py code that you think should accomplish the 
> above? I think it should be doable.
>
> I think what you want in routes_in is:
>
> 1. handle any other apps explicitly (admin, for example)
> 2. if the subdomain is dashboard, prefix init/dashboard
> 3. if the controller is now dashboard, it's an error
> 4. everything else gets passed through
>
> Then in routes_out:
>
> 1. strip init/dashboard
> 2. strip init
>
> The only problem I see is routes_in step 3 above: you don't want to allow an 
> access of the form example.com/dashboard/function, because it's ambiguous on 
> output. If that's not a problem though....
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to