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

404 and strict URLs

How Do I?

ee-ulrich's avatar
ee-ulrich
6 posts
10 years ago
ee-ulrich's avatar ee-ulrich

Hi community, hope somebody can help me.

I,m trying to redirect to a 404 page if somebody type a wrong URL path. Lets say: The correct URL is: http://testdomain.com/segment_1/segment_2/segment_3/…

e.g. http://testdomain.com/health/vitamins/vitamin-d or one more subcategory like http://testdomain.com/health/general-informations/toxins/toxi-for-cancer-cells

For health as segment 1 the 404 redirect is standard an works fine. e.g heelth instead health would show the 404 page. But for Segment_2, Segment_3 …. i can,t find any reasonable way. IF I change general-informations (segment_2) into something else, it dosent matter, i,m not redirect to 404. It dosent matter if i use e.g. {no result}, {if segment_2 or 3 != ""} or what ever. I always get a list with entries.

But I like that only the exact URL should match and show the right results all other url entries should show the 404 page.

Thanks for any help

       
jay_turley's avatar
jay_turley
46 posts
10 years ago
jay_turley's avatar jay_turley

I ran into this problem myself, and am still searching for a good solution. As far as I understand it, there is no way other than laboriously white-listing permitted URLs. This is due to the URL-driven nature of EE.

And if I’m wrong, I sure wish someone with more experience will come in and say so 😊

The closest I could come was heavily customizing the templates in each template group to specifically target the last segment they were expecting, i.e. the index template targets segment_2, all the other templates in the group target segment_3.

Good luck.

       
Boyink!'s avatar
Boyink!
5,011 posts
10 years ago
Boyink!'s avatar Boyink!

You can usually write rules to capture the majority of 404 situations in EE.

This is still a good overview of the process:

http://joviawebstudio.com/index_ee.php/blog/guide_to_404_pages_with_expressionengine/

       

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.