1

If I enter the URL to a channel that was deleted months ago, my EE install seems to default to the homepage. I have read up on strict URLs, but if enabled, EE checks whether the first segment in the URL corresponds to a template group so its not possible to access templates directly inside the site group folder without adding it into the URL. Is there anyway to ensure old URLs like this display the 404 page listed, rather than the homepage without the use of a manual 301 redirect?

1

Enabling strict urls means that EE checks whether the first segment in any URL corresponds to a template group. If that's not the case, EE will display a 404. To my knowledge there is no relationship between this and what you say here

any templates in the site directory need to have the site folder name in the URL

Maybe you have to edit your question and elaborate. As far as I can see, simply enabling site URL should work in your case. If you want to target entries rather than template group, have a look at the require_entry parameter for the channel entries loop. If you want an in depth look at 404 pages, I recommend this guide to 404 pages in ExpressionEngine.

EDIT: question clearer now

I want to be able to access domain.com/template.html, not domain.com/site/template.html, but at the same time, not have domain.com/old_template_group/template take me to the homepage, instead take me to the 404 error page.

EDIT: cannot see any easy way

If you activate strict_url and then do a mod rewrite from /template to /site/template, EE will still redirect you to a 404 because your first segment will not be a legit template group.

5
  • I have edited my question to read a little better, as what you have responded is exactly what I was describing in my question. – ccdavies Feb 18 '13 at 13:55
  • Sorry I still don't get it. First part of the question is that you want EE to check whether the first segment in your URL corresponds to a template group > strict_url. Is it that, on top of that, you want to be able to access templates in your default "site" template group without specifying /site/template in the URL, but rather just /template? – Jérôme Coupé Feb 18 '13 at 14:03
  • No, what I want to understand is how I can have 404 pages displayed for deleted channels etc, but still be able to use templates with the site channel without including the site group template name, so for instance, inside my site group is 'template.html', I want to be able to access domain.com/template.html, not domain.com/site/template.html, but at the same time, not have domain.com/old_template_group/template take me to the homepage, instead take me to the 404 error page. Does that make sense? – ccdavies Feb 18 '13 at 15:42
  • It does. To my knowledge, not possible without 301 .htaccess redirect. Edited my answer to reflect. – Jérôme Coupé Feb 18 '13 at 16:26
  • Actually, I just tested that with a simple rewrite rule and didn't find any way to accomplish what you want easily (see updated anwser) – Jérôme Coupé Feb 18 '13 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.