On Aug 31, 2007, at 2:25 PM, Jose Galvez wrote:
Dear Ben,In general I agree with you ambiguity is bad, and /user should be different from /users/index, however users are also lazy, and they have grown accustomed to being able to type http://somewebsite/ and having that return a page. so I'm just trying to figure out how to get my users to main/index (I always call my main controller "main"). Since pylons does not map to files directly, but to controllers, I've used the thought that http://mysite/something should be equivalent to http://mysite/something/index just as it would be on a filebased system ( http://mysite/something == http:// mysite/something/index.php, index.html or what ever the default "page" is). Not sure if this makes sense or even if its valid. I'd be really interested in your thoughts about this
The way a great many websites work is by redirecting / to either / their/homepage.cgi or some other URL. Sometimes its quite a big url, the user is only typing something.com/ though. Under Routes 2.0 with the built-in redirect ability, you'd be free to setup the main / to redirect to your main controller.
In the latter case you mention, its not mysite/something == mysite/ something/index.php but mysite/something/, with the trailing slash as well. I think it would still be fine to leave off the very last part but require the trailing slash, and have that redirect to your 'default'. But the more minimizing, like having:
/users Be equivilant to: /users/home/index As a route like:map.connect(':controller/:subsection/:action', subsection='home', action='index')
Would cause to occur. These URL's having multiple sections cutoff never existed very heavily before Rails, as webservers will let you drop off the last part and search for a directory index "index.php/ index.html/etc", they wouldn't let you drop off multiple URL parts.
So I'm thinking you'd have:
map.redirect('/', controller='main', action='index')
And it'd end up redirecting you to:
/main/index
Or if you had:
map.connect('/:action', controller='main', action='index',
redirect=True)
Then it would redirect / to /index should there be a default option and you explicitly said to redirect. This would only work when leaving off the last part, like how Apache directory index works when just the last part is left off.
How's that sound? Cheers, Ben
smime.p7s
Description: S/MIME cryptographic signature
