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 redirect not working, sending to another segment

How Do I?

dagga's avatar
dagga
15 posts
10 years ago
dagga's avatar dagga

I’m having problems with a template sending a missing page to another segment rather than the 404 page. For example, The URL below would give us our Disney Ship.

http://www.example.com/cruises/disney/ships/disneyship/

What happens if someone types this?

http://www.example.com/cruises/disney/ships/disneyshipTHISSHOULDNOTBEHERE/

It should 404 correct? Instead, it keeps the URL above in the browser but displays the contents of segment 2.

I’ve been testing all over the place and slimmed down the code for testing to just this:

{exp:channel:entries channel="at_cruise_ships" require_entry="yes"}
 {if no_results}
  {redirect="404"}
 {/if}
  <h2>{title}</h2>
    {body}
{/exp:channel:entries}

NOTES: - this works great if i do the same scenario in segment 2. For example, http://www.example.com/cruises/disneyTEST/ will redirect to the 404 page as expected - the disney ship exists in the cruise_ships channel - strict URLs is enabled in preferences - my 404 template is assigned in preferences - I am using Structure, but not directly related to this page

Please let me know if you have any suggestions on this as i’m at a loss. Thanks!

Also, i see a similar issue on a past post, but I didn’t see a solution.

http://expressionengine.stackexchange.com/questions/1636/why-doesnt-404-kick-in-when-a-bad-url-is-entered

       

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.