3

My client sometimes needs to set a page as "Closed", but the url still gets traffic, and the users will now see a broken template page.

I would like to redirect the user to a 404 page upon visiting a "Closed" page.

How would I go about doing this? I'm very unfamiliar with EE, but because this site was made years ago by an earlier employee, I must find a solution to this, even with my lack of experience.

This exact type of question was explained here - redirect_to_404_when_expressionengine_entry_has_closed_status

...but I couldn't manage to make any sense of it, with so many comments giving different solutions and fixes of their own, I was left confused, and while trying what the post explains, I've yet to get it to work, and I can't necessarily follow the steps correctly, since I don't know too much about how EE works. This is a ExpressionEngine v 1.7.0 site.

I have FTP access and Super Admin access.

6

I've never used EE before version 2 so not 100% sure this will work, but hopefully it helps.

Inside your weblog entries tag (I am assuming it is a weblog entries tag, if it is not, post what it is here) put the following code:

{if no_results}
    {redirect="404"}
{/if}

This also assumes you have a 404 page set up in your configuration. This may not work, but if it doesn't we'll need more information, namely the tag in question that is displaying the entries (something like: {exp:weblog:entries ...}).

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.