We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Custom urls (aliasing) for existing and new content

Development and Programming

onewed's avatar
onewed
13 posts
14 years ago
onewed's avatar onewed

I’d like to get around the default url path behavior where paths are mapped to template groups and templates. We have a number of existing paths that have to be migrated over to EE. These include full channels, filtered channels, single channel entries, etc. We also want to use our own url scheme for future SEO purposes. This would be more akin to Drupal-like or pure MVC url handling where urls are mapped to behavior, rather than templates (how EE and Wordpress operate).

We want to avoid 301 redirects for the existing content. I’ve seen that the Pages module can be used for a single entry, which we may use in some cases. However there remains the majority of our urls like any of the following

/wedding-dresses : full channel index page /wedding-dresses/a-line : filtered channel by a single custom field /wedding-dresses/designer/davids-bridal : filtered channel by designer (relationship) /wedding-dresses/search/?x=35&y=21&tags;[Style]=3&tags;[Embellishment]=44 : channel with many filters

What I think I want is a way to use an extension hook to look at urls before execution or just before a 404 response, decide which channel content to show and render a specific template. Is this possible?

I want to avoid doing a lot of url aliasing logic and embedded template rendering within a 404 template. To me that isn’t an appropriate course for separation of logic.

Edit: I’ve found the Detour extension which does a simple lookup at session start. This is a useful stepping stone. The remaining question is the best path to take to instruct from the extension which channel content to load and which template to render.

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

Hi there

You could use segment conditionals to your advantage here. Keeping your conditionals “simple” would make something like this effective/possible:

Assuming the url options you provided.

{if segment_2 == ''}
 -- empty segment 2 means we use our full channel index code --
{/if}
{if segment_2 == 'designer'}
 -- segment triggers designer filter code --
{/if}
{if segment_2 == 'search'}
 -- segment triggers search mode with $_GET var usage (which would probably require an add-on for optimal performance) --
{/if}
...etc...

There are many ways to achieve this. It will just depend on your needs ultimately. I like the idea of starting from a set of URLs and URL structures then working toward a template group / template approach from there.

       
onewed's avatar
onewed
13 posts
14 years ago
onewed's avatar onewed

There must be a better way to do routing than in a template with a bunch of {if} statements and embeds. It seems like such a bad method. I’d be happy with a module that looks at the url and says “hey, you should render x/y.html”.

One major problem is we want one search results page that shows content filtered depending on the url. The urls are like this

/wedding-dresses/embellishment/sash /wedding-dresses/embellishment/beading /wedding-dresses/embellishment/lace

It’d be repetitive and unwieldy to create multiple Page entries that all link to one template.

       
onewed's avatar
onewed
13 posts
14 years ago
onewed's avatar onewed

Is there any method to create a Pages entry with a wildcard at the end of the path? I’d be happy with /wedding-dresses/embellishment/.* to point to a dummy channel entry with a specific template.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.