1

Google's Webmaster Tools tells me I have a bunch of pages without titles. Upon examining the URLs listed, it would appear these are a mix of faulty links, deleted posts, changed titles. Somewhere, they must still be referenced (probably not on my site), and because the url structure is essentially correct, EE outputs a page with everything but an entry on, so of course it lacks a title.

What are the options for dealing with something like this? I may be somewhat limited by the fact that I use some non-standard rewrites to compensate for how the site was initially setup. I'll include an example below:

RewriteRule ^/?((About|Contact|Copyright|Privacy_Policy|Search)(/.*)?)$ /index.php/Westeros/$1 [NC,L]
RewriteRule ^/?((Digest|Links|Store|Updates)(/.*)?)$ /index.php/$1 [NC,L]
RewriteRule ^/?Citadel/((Editions|Spoilers)(/.*)?)$ /Citadel/index.php/Citadel/$1 [NC,L]
RewriteRule ^/?Citadel/((Articles|Concordance|FAQ|Gallery|Heraldry|Prophecies|SSM)(/.*)?)$ /Citadel/index.php/$1 [NC,L]

The first rule is of course an iffy one, since it breaks the rule of not taking out template groups. The second is just a variant on the typical index.php removal.

The third and fourth rules exemplify the same thing except for one of the subsites which reside in an actual subdirectory and use their own index.php (but the same .htaccess).

Given that setup, is there anything I can do to keep EE from treating incorrect urls following /Entry/ as valid pages?

1 Answer 1

2

It sounds like you have single entry pages that should be outputting a 404 instead of rendering the page without a valid entry. Check your tags on these pages to ensure they are using the require_entry= parameter. Used in conjunction with a {redirect="404"}, that will address landing on entry URLs that are not valid.

6
  • 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. Commented Apr 18, 2015 at 19:51
  • 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? Commented Apr 20, 2015 at 1:47
  • 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} Commented Apr 20, 2015 at 6:52
  • {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. Commented Apr 20, 2015 at 13:42
  • 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. Commented Apr 20, 2015 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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