Hi everyone
We’ve found a bug that were having difficulty trying to find a fix for. We have discovered you are able to view a page even if the segments are not correct for the page
For example we would expect to view the page
http://www.churchill-security.co.uk/locations/north-west-security/north-west-security-guardsbut if we change segment 2 to be south-west-security (which is a valid segment name) it returns the same page but in an obviously incorrect URL structure
http://www.churchill-security.co.uk/locations/south-west-security/north-west-security-guardsIs there a way to have this page return a 404 ?
Hi wildrock thanks for your reply but were unable to get the Strict URLs to work for this scenario.
The problem seems to be that as long as segment 2 exists, any page title/slug is allowed to render no mater which segment 2 is used in the URL. We have listed the page under specific categories so we would have expected that it would only render if the category segment name is in the URL and 404 if not but this doesn’t seem to be the case.
Are there any if statements that we could use to check the URL path is correct?
Thanks
This might be of some help with segment_2 and strict URLs.
The simple fix (for me anyways):
Enable Strict URLs. (This checks to make sure you have a valid template group)
Within the index.html of that group, add
{if segment_2 != ''} {redirect="404"} {/if}Now if someone hits a segment_2 that does not exist, they will be redirected back to the index.html of that group. Since segment_2 is not empty, they will now be redirected to your 404.
Reference: http://ellislab.com/expressionengine/user-guide/cp/design/templates/global_template_preferences.html
I hope this helps with your issue.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.