Hi,
I’m trying to use this metod to handle incorrect URLs, but can’t get it to work correctly.
The situation is:
http://www.domain.com/hotels/paris/ritz_hotel
template group: hotels
Then I got index template with a list of cities and separate template for each city that’s doing two things - if no hotel name in segment_3, then it shows list of all hotels in the city, if the hotel name is in segment_3, then it shows the hotel details.
Now, I want to get 404 every time someone will put incorrect URL.
For the index, I put:
{if segment_2 != ''}
{redirect="404"}
{/if}and it works fine (all the http://www.domain.com/hotels/parisasdkhagskdjh are redirected to 404).
For the city-template I did:
{if segment_3==""}
Hotels in {segment_3}:
1)
2)
{if:elseif segment_3!="" AND segment_4!=""}
{redirect="404"}
{if:elseif segment_3!=""}
{exp:weblog:entries weblog="hotels" limit="1" dynamic="on" require_entry="yes"}
{if no_results}
{redirect="404"}
{/if}
Hotel: {title}
{body}
{/exp:weblog:entries}
{/if}and the problem is that when URL is http://www.domain.com/hotels/paris/ it doing no_results redirect from 3rd if ... but shouldnt :(
Am I missing something? Could you please, help me with that?
EE 1.6.7 Build: 20090515