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

Friendly URL problem

How Do I?

andrew001's avatar
andrew001
136 posts
9 years ago
andrew001's avatar andrew001

Maybe Im not thinking this fully, but here is the issue. My “old” website has a URL structure as:

www.mysite.com/products/product-1

www.mysite.com/products/product-2

www.mysite.com/products/product-3

and so on….

I am now building the new site, and am trying to keep the URL structure intact as much as possible to eliminate broken URLs. I would like to keep one channel for all products and generate this dynamically. I dont want to have to create a page template per.

My logic, or rather, what I am used to in EE is something such as:

www.mysite.com/products/detail/product-1

www.mysite.com/products/detail/product-2

www.mysite.com/products/detail/product-3

This would be the basic “master/detail” page setup

Note, this system is on windows iis, and I have zero experience on any URL rewrites.

What/how would I go about achieving the result above (www.mysite.com/products/product-1) in EE?

       
MacMastermind's avatar
MacMastermind
118 posts
9 years ago
MacMastermind's avatar MacMastermind

There are probably better answers here, but I’ve always just had to use conditionals that trigger off of the url and store templates that embed the same single page containing all of the conditionals…

Example, index holds all HTML including the EE conditionals for URL segments (if segment_2==”x”, last_segment==”y”, etc). Then “x” and “y” are named templates in that same template group that contain the same embed tag: embed=”group/index”.

That way, I never have to code more than one page, and I can use URLs for if/then triggers…

Hopefully that’s less confusing than it sounds…

-Tony

       
Rob Allen's avatar
Rob Allen
2,950 posts
9 years ago
Rob Allen's avatar Rob Allen

Similar to above:

Using your products/index template you can use conditionals to see if segment_2 is blank or not and output relevant data:

{if segment_2 == ""}
    Output all products
{/if}

{if segment_2 != ""}
    Output your single product stuff
{/if}
       
andrew001's avatar
andrew001
136 posts
9 years ago
andrew001's avatar andrew001

What would the URL for that be then?

<a href="http://{url_title_path=product/{title}}">{title}</a>

isnt working

       
andrew001's avatar
andrew001
136 posts
9 years ago
andrew001's avatar andrew001

actually… let me take a few steps forward here.

We are adding the detail page… but after products/product name.

Example: Old URL: www.mysite.com/product/my-product

New url: www.mysite.com/product/my-product/details

So we need the similar url as the old, but with the addition of the detail. make sense?

       

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.