ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

URL question

December 28, 2012 9:02am

Subscribe [2]
  • #1 / Dec 28, 2012 9:02am

    transparentb

    24 posts

    I’m building a template for landing pages based on location (there are thousands) and I’d prefer to be able to use domain.com/location instead of having to use domain.com/template/location. What’s the best way to do this?

    My best guess would be some kind of logic checking specified entries against segment_1 in the index…......... or something like that?

  • #2 / Dec 28, 2012 3:47pm

    Kevin Cupp

    791 posts

    There’s a few ways. If you’re loading the site’s default index template for these requests, you should be able to do this with Strict URLs turned off. You can see if it works dynamically, or load the channel entry based on segment_1. Or you can use the Pages module and set any URI you want for an entry. Or you can use .htaccess to rewrite certain requests behind the scenes, so that /location really loads /template/location but doesn’t redirect.

  • #3 / Dec 29, 2012 9:51pm

    transparentb

    24 posts

    There’s a few ways. If you’re loading the site’s default index template for these requests, you should be able to do this with Strict URLs turned off. You can see if it works dynamically, or load the channel entry based on segment_1. Or you can use the Pages module and set any URI you want for an entry. Or you can use .htaccess to rewrite certain requests behind the scenes, so that /location really loads /template/location but doesn’t redirect.

    Thank you for the response, Kevin! I’m taking the Strict URLs off route. I do have a question about the way EE routes URLs though: if we type in domain.com/anything and there’s no corresponding template group or template, does it always go through the specified index template? This seems to be how things work but I just want to make sure.

  • #4 / Dec 30, 2012 11:59am

    Kevin Cupp

    791 posts

    Yep that’s right. As along as you don’t have Strict URLs turned on, it should just load your site’s homepage index template and add the segments on the end. That’s also assuming your .htaccess rewrite doesn’t impose any restrictions on what gets passed to EE, some folks make it so only template group names are passed to index.php.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases