One of our clients is having a problem with Google indexing incorrect URL's.
The shop templates are using something like...
{if segment_2 != "" AND segment_3 == "" AND segment_4 == ""}
Parent Category List
e.g. http://website.com/shop/parent/
{if:elseif segment_2 != "" AND segment_3 != "" AND segment_4 == ""}
Child Category List
e.g. http://website.com/shop/parent/child/
{if:elseif segment_2 != "" AND segment_3 != "" AND segment_4 != ""}
Product
e.g. http://website.com/shop/parent/child/product/
{/if}
But, they are getting URL's such as...
- http://website.com/shop/product/product/
- http://website.com/shop/category_group/product/
- http://website.com/shop/parent/child/P568
- http://website.com/shop/gahhaiiuznyofiw.html/P171
- http://website.com/shop/product/cxdrclhujw.html/P216
- http://website.com/shop/P1130
Which obviously don't exist and are picking up on the incorrect pagination amount etc.
Why would this happen, and how can this be stopped? E.g. how can we enable a 404 error for these kinds of pages.
The only way I've been able to fix it is for EE to check if the segments are a valid category or product, and then throw a message such as "No products found" or "Category doesn't exist"
But I just don't know how it's finding and generating these weird URLs. Obviously the "P1130" exists because it's showing ALL products, but that page shouldn't be accessible.