301删除旧页面后重定向到新页面?

时间:2012-03-10 10:45:05

标签: apache .htaccess redirect

我将论坛从子目录删除到子域。子目录中的那个只有2周大,但其中一个页面获得了大量的点击。但是,它已不复存在。它现在存在于新的子域中。我是否可以从子目录中的非存在页面创建301重定向到子域中的现有重复页面?

我试过了:

redirect 301 /forum/viewtopic.php?f=30&t=45 http://forum.hollywoodnose.com/questions/126/alternative-ways-to-look-younger

但这不起作用......就像我说/forum/viewtopic.php?f=30&t=45不再存在。但是,它与http://forum.hollywoodnose.com/questions/126/alternative-ways-to-look-younger相同。 /forum/viewtopic.php?f=30&t=45已编入索引...如何进行此301重定向?谢谢

1 个答案:

答案 0 :(得分:1)

RewriteEngine On
RewriteBase   /

RewriteCond   %{QUERY_STRING}  \bf=30\&t=45\b
RewriteRule   ^forum/viewtopic.php$ \
   http://forum.hollywoodnose.com/questions/126/alternative-ways-to-look-younger [R=301,L]