Welcome Guest, Not a member yet? Register   Sign In
SEO-friendly URLs and controllers vs parameters
#1

[eluser]Andy UK[/eluser]
Hi guys, could someone point me in the right direction with this problem related to SEO friendly urls?

I'm trying to get the following url scheme to work:

/projects/neighbourhood (lists projects in a specific neighbourhood)
/projects/neighbourhood/project_name (show details of specific project in specific neighbourhood)

It was easy enough to create a controller called projects and hard-code each neighbourhood as a function name. Trouble is, I want to keep the same url design for showing project details, although the project name is now a parameter.

I tried detecting if a parameter was passed to the neighbourhood function and running different code if set, but if no parameter is passed, it fails. I'm thinking that .htaccess might be the solution, but i don't want to re-write urls.

Am i right in thinking routes might help? I'd appreciate someone pointing me in the right direction with this so i can study up on how to do it. In case the above wasn't totally clear, here are a few examples:

/projects/brickell/icon-brickell (shows project details for icon brickell)
/projects/south-beach (lists projects available in south beach)
/projects/south-beach/courts (shows project details for courts)

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB