重定向除一个查询字符串以外的所有URL

时间:2012-09-03 08:01:05

标签: .htaccess redirect url-rewriting url-routing

我有2个域mcleancenter.orgaldentheatre.org,两者都指向一个目录。我想将没有URLs的所有"alden-theatre"重定向到mcleancenter.org。并且"alden-theatre"URLs的所有网址都应重定向到aldentheatre.org

例如:

  • /about应重定向到mcleancenter.org/about
  • /contact应重定向到mcleancenter.org/contact
  • /alden-theatre应重定向到aldentheatre.org/alden-theatre
  • /alden-theatre/perfomance应重定向到aldentheatre.org/alden-theatre/perfomance

非常感谢任何帮助。

2 个答案:

答案 0 :(得分:0)

您使用的是哪个服务器?

您可以在任何情况下通过在您使用的任何服务器之前将Apache服务器作为代理'来实现。然后,您可以使用mod_reqwirte重定向请求。

答案 1 :(得分:0)

所有重定向到mcleancenter.org的网址只是重定向

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^alden-theatre(.*) http://www.aldentheatre.org/alden-theatre$1 [R]

希望这会有所帮助

相关问题