Timeline for How to keep EE from rendering invalid urls as valid pages?
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 20, 2015 at 21:39 | comment | added | Linda Antonsson | Though I realise now it causes another issue. I run two sites off one install using the old method rather than the MSM and now they get the same 404. Well...I'll just have to make it more generic and include links to both sites. | |
Apr 20, 2015 at 21:37 | comment | added | Linda Antonsson | Thank you, got it sorted now. I had convinced myself that the 404 feature would only work with strict urls enabled and made an error in the redirect setup. But now it works, without strict urls. | |
Apr 20, 2015 at 13:42 | comment | added | Derek Jones |
{redirect="404"} inside the no_results will take care of that for you (displaying the right content and sending the right header), and using PHP to halt the script at that point in the template parsing will leave some things unfinished.
|
|
Apr 20, 2015 at 6:52 | comment | added | Linda Antonsson | It does. I don't think the issue is that the rewrites are too broad, but because I remove the template group in some cases, enabling strict urls (as I understand it) would break those. What I ended up trying together with require_entry was this: {if no_results} <? Header( "HTTP/1.1 404 Not Found" ); Header( "Location: westeros.org/404" ); die(); ?> It works, but maybe it won't register as a proper 404. {/if} | |
Apr 20, 2015 at 1:47 | comment | added | Derek Jones | Your rewrites should only be writing to locations that you want, those I would change. URLs that are invalid in EE, I would make EE output as invalid (404). If you just redirect to the index page, you will likely get penalized for having duplicate content on those URLs, since they will all be serving your home page. You should use 301 redirects for old URLs that no longer exist, to direct search engines to the new location, rather than rewriting to compensate. Make sense? | |
Apr 18, 2015 at 19:51 | comment | added | Linda Antonsson | Thank you. I don't think it quite solves my issue, since while require_entry would work fine, enabling strict urls to use the 404 redirect would (I think) conflict with some of my rewrites. But I suspect that's as close I'll get; perhaps require_entry together with a conditional on no results might still be able to do something. Might be a redirect to the index page would at least avoid invalid links being indexed. | |
Apr 18, 2015 at 19:48 | vote | accept | Linda Antonsson | ||
Apr 18, 2015 at 14:47 | history | answered | Derek Jones | CC BY-SA 3.0 |