On Sat, Jul 17, 2010 at 12:12 PM, Eric <[email protected]> wrote:
> I'm working on a Pylons project (only about midway through
> development) and I ran into this same issue.
>
> Essentially, I want people to be able to visit a section by going to
> <url>/<section name>, so I added this generic line at the end of the
> routes file:
>
>    map.connect('/{title}', controller='main', action='section')
>
> The controller action then starts with this:
>
>    def section(self, title):
>        title = title.lower()
>
> That way it always queries the section name in lowercase (looking for
> an exact match to the lowercase name in the database) regardless of
> how it was typed in, or returns 404 if there is no page with that
> name.

I would do:

# /{title}
def section(self, title):
    key = title.lower()
    if key != title:
        redirect(url("section", title=key))
    content = LOOKUP(key)

> It works, but will this be a problem for Google rankings or
> anything else?

Proxy servers and caches won't know both pages are the same, so
they'll cache both separately. People will bookmark undesired URLs.
Tim Berners-Lee will hate you. Each page should have one canonical
URL, not several.

Google guesses which URL it thinks is canonical and suppresses the
others unless you answer yes to "Show results that are very similar to
the above?"

-- 
Mike Orr <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to