Redirect deleted Topics to home

Discussions about Apache mod Rewrite, .htaccess, Use, experiences ... URL Rewriting.

Moderator: Moderators

Redirect deleted Topics to home

Postby Bine80 » Thu May 10, 2012 7:37 am

Hello everybody!

I deleted some spam post on my premodded phpbb3, now google (google webmaster tools) shows me several 404s.

I want to redirect the deleted, so in edit my .htaccess file at the beginning:

Code: Select all
redirect 301 /forum/spampost1.html http://www.mydomain.com


but now the the redirect goes to to my homepage but with this path: http://www.mydomain.com/?forum_uri=spamlost1&start=

how can I redirect all the deleted post to my homepage??
Bine80
 
Posts: 2
Joined: Thu May 10, 2012 6:29 am

Advertisement

Re: Redirect deleted Topics to home

Postby Stephen26 » Thu May 10, 2012 9:01 am

Make a backup of viewtopic.php first.

In viewtopic.php, add :

Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if (!empty($phpbb_seo->seo_opt['zero_dupe']['on'])) {
        $phpbb_seo->seo_redirect($phpbb_seo->seo_path['phpbb_urlR']);
}
// www.phpBB-SEO.com SEO TOOLKIT END

Before all occurences of :
Code: Select all
trigger_error('NO_TOPIC');

In viewtopic.php, add :

Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if (!empty($phpbb_seo->seo_opt['zero_dupe']['on'])) {
        $phpbb_seo->seo_redirect($phpbb_seo->seo_path['phpbb_urlR']);
}
// www.phpBB-SEO.com SEO TOOLKIT END

Before:
Code: Select all
redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&f=$forum_id" : '')));


Then use http://web-sniffer.net/ to see if deleted topics get correctly 301 redirected to root.
I install and configure phpBB-SEO (and other mods) for a fair price and very fast. If you are interested simply send me a private message.
Stephen26
phpBB SEO Team
phpBB SEO Team
 
Posts: 427
Joined: Mon May 03, 2010 7:06 am

Re: Redirect deleted Topics to home

Postby Bine80 » Thu May 10, 2012 12:46 pm

Excellent!!! Thank you very much!
Bine80
 
Posts: 2
Joined: Thu May 10, 2012 6:29 am


Return to Apache mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 8 guests