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

Why no 404?

Development and Programming

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

I have a site which got a temporary page indexed by google, and then the page was removed, but going to the URL gives content from the previous URL segment, and I am trying to figure out how to get this URL to generate a 404 instead.

In more detail:

I had a page at http://mydomain.com/my-template-group/my-template (not the real names)

This content was removed from the site. There is no longer a template in my-template-group named my-template, but when the url http://mydomain.com/my-template-group/my-template is visited, instead of showing a 404 for content and templates that are no longer there, the site instead shows the content for http://mydomain.com/my-template-group

In fact, while investigating this, I realized that visiting http://mydomain.com/my-template-group/anything-at-all does not generate a 404 as it should, and instead displays the content for my-template-group instead.

Is this default behavior? And how can I fix it so visiting any page that is not specifically a template generates a 404?

Thanks tons.

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

I’ll answer part of my own question for posterity. Sigh. It is default behaviour.

https://ellislab.com/expressionengine/user-guide/urls/404pages.html

However, after reviewing this, I still don’t see a way to solve the problem.

{if no_results}
    {redirect="404"}
{/if}

is no use because there are results in my-template-group, and surely I wouldn’t have to do something like:

{if segment_3 != 'my-template' && segment_3 != 'my-template-2' && ... }
  {redirect="404"}
{/if}

and explicitly list out every template in the template group that should NOT give a 404? Or would I?

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

Peruse this:

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

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

Thank you, this was a good resource.

       

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.