Log in

View Full Version : 301 Redirect Deleted Threads to Forum Index


regeneration
01-14-2011, 10:48 PM
Hi Everyone,

I have a question and hoping someone could help me out.

As you know, if someone is visiting a deleted thread on Vbulletin, he will get an "invalid thread" page. What I'm trying to do is... to add a 301 redirect to forum index page after a few seconds inside the "invalid thread" page, but with PHP redirect (not meta refresh).

I've tried to create a PHP function that does that, but it doesn't work (blank page).

Does anyone have a clue?

Thanks in Advance,

kh99
01-14-2011, 11:01 PM
Did you try something like:

$vbulletin->url = 'index.php?' . $vbulletin->session->vars['sessionurl'];
eval(print_standard_redirect("Invalid Thread", false));


You can also use a phrase instead of text (see function print_standard_redirect() in includes/functions.php).

ETA: sorry, I just reread your post and noticed the "after a few seconds" part, so maybe this doesn't help. (But maybe that's what the "forceredirect" parameter of print_standard_redirect() is for?).

Alfa1
01-14-2011, 11:18 PM
Wouldn't that cause even more confusion than the also confusing 'no permissions' page?

JamesC70
01-15-2011, 05:31 PM
As you know, if someone is visiting a deleted thread on Vbulletin, he will get an "invalid thread" page. What I'm trying to do is... to add a 301 redirect to forum index page after a few seconds inside the "invalid thread" page, but with PHP redirect (not meta refresh).

I've tried to create a PHP function that does that, but it doesn't work (blank page).

A PHP redirect is done in the header (http://php.net/manual/en/function.header.php) of the page. Since you're already sending a page saying "invalid thread", you can't add the redirect later in the page.

Instead, maybe you could create an HTML form with only a submit button... which then takes the viewer to whatever page you wanted to redirect them to. The form would ideally display inside the error message box, so that it's obvious to the viewer that they should click it to return to your forumhome.