Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 重定向除一个查询字符串外的所有URL_.htaccess_Redirect_Url Rewriting_Url Routing - Fatal编程技术网

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

.htaccess 重定向除一个查询字符串外的所有URL,.htaccess,redirect,url-rewriting,url-routing,.htaccess,Redirect,Url Rewriting,Url Routing,我有两个域mcleancenter.org和aldentheatre.org,都指向一个目录。我想将所有没有“奥尔登剧院”的URL重定向到mcleancenter.org。而所有在URL中包含“奥尔登剧院”的URL都应该重定向到aldentheatre.org 例如: /about应重定向至mcleancenter.org/about /contact应重定向至mcleancenter.org/contact /alden剧院应重定向至aldentheatre.org/alden剧院 /ald

我有两个域
mcleancenter.org
aldentheatre.org
,都指向一个目录。我想将所有没有“奥尔登剧院”的
URL
重定向到
mcleancenter.org
。而所有在
URL
中包含
“奥尔登剧院”
的URL都应该重定向到
aldentheatre.org

例如:

  • /about
    应重定向至
    mcleancenter.org/about
  • /contact
    应重定向至
    mcleancenter.org/contact
  • /alden剧院
    应重定向至
    aldentheatre.org/alden剧院
  • /alden剧院/performance
    应重定向至
    aldentheatre.org/alden剧院/performance

非常感谢您的帮助。

您使用的是哪台服务器


在任何情况下,您都可以将Apache服务器作为代理“放在”正在使用的任何服务器之前。然后,您可以使用.

重定向请求,因为所有URL都重定向到
mcleancenter.org
只需重定向即可

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

希望这会有所帮助

我已经共享了主机,所以我没有访问appache服务器的权限。它正在将url中包含alden theatre的url重定向到,但没有将url重定向到www.mcleancenter.org/about-us