5

Got a very weird issue with an old EE (1.7) site, not one i've seen before.

After a server migration, we started getting a number of odd URLs being reported in Webmaster tools, all throwing errors (301 mainly)

The URLs were structured differently, but nearly all contained a web or email custom field in there somewhere - something like this

category/post-type/www.url.com/P0/

I've absolutely no idea how these URLs are being generated or how they are being formed. Anyone got any ideas where I could start to look? Completely at a loss.

Cheers Matt

| improve this question | | | | |
9

I have seen this several times over the years. If you don't properly have your 404 pages some other website out there is generating these urls and they are coming back valid. Then when google indexes those sites the urls show up. Google doesn't know these are invalid URLs. The best way to prevent this is to make sure you tighten your 404s. Make sure you have any wrong group and/or page go to a 404 page.

Here is a good article on it:

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

Big thing is using Strict URLs and having require_entry="yes" set in your channel entry tags.

Hope this helps!

Brad

| improve this answer | | | | |
  • Thanks Brad, I was hoping that wasn't the answer as this site has been built in such a complex way (not by me!) that a robust 404 structure is going to be a nightmare! But thanks for the heads up all the same – Matt Powell Nov 29 '12 at 16:58
1

Usually this happens when:

  1. A client has a field that is supposed to contain a URL starting with http:// and they enter data without the http://. so it becomes a relative URL

  2. There no error checking in the template to ensure that crazy long URLs are avoided.

It's actually not that hard to fix.

  1. Do a quick look at all the values in the database for that field (or create a quick template that outputs that field for all entries ; add http:// to the entries. (Bonus: Add instructions to that URL collecting field that tells people to remember the http

  2. Add this to the /category/post-type template, anywhere:

    {if segment_4 != ""}{redirect=404}{/if}

This says, if there's extra segments on the end of the URL (i.e. you'd never expect a valid segment_4 for that part of the site) then display the 404 page.

You can clean up some more of the bad pages with Strict URLs and having require_entry="yes" set, as another responder says, but the quickest fixes and likely causes are these.

| improve this answer | | | | |
  • The structure on this site makes the 404s / strict URL thing quite difficult. I wonder, is there any EE dev out there who fancy a bit of work trying to implement this for us? The site is on EE 1.7.2. Please message me at matt at madeupdesign dot com if interested - cheers! – Matt Powell Nov 30 '12 at 10:15
  • Travis, I have the same issue on my site and I was wondering if you could clarify if you mean that 1 & 2 are both needed for this to be an issue, or would it be occurring even without 1? I know 1 isn't an issue for my site, but I get tons of these URLs in Webmaster Tools. Like Matt, I have a site structure that precludes using Strict URLs. – Linda Antonsson Dec 5 '12 at 21:12
  • Linda, This could be occurring without 1 -- in fact, it quite easily could. It's just that quite often you see these two problems in combination. It really is quite easy to fix, once you know what the solution is. (You may have to implement the fix over and over in many templates, of course...) – Travis Smith Dec 7 '12 at 7:32

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.