代码之家  ›  专栏  ›  技术社区  ›  Ron

htaccess不会重定向到第二个顶级文件夹

  •  0
  • Ron  · 技术社区  · 7 年前

    我使用htaccess来分离实际的域文件名,例如

    RewriteRule   ^Contact/?$ /maindomain/contactus2001.php [NC,L]
    

    在这个领域工作得很好myxyzdomain.com网站,位于顶层文件夹中。

    /myotherdomain
    

    我想对它的URL做同样的处理,如下所示:

    RewriteRule   ^Information/?$ /myotherdomain/info20123.php [NC,L]
    

    但那不管用。我得到一个“多选”错误,但错误详细信息只显示一个选择。错误说明:

    Multiple Choices
    The document name you requested (/Info) could not be found on this server. However, we found documents with names similar to the one you requested.
    Available documents:
    
    /info20123.php (common basename)
    

    我是犯了什么错误还是不可能。

    1 回复  |  直到 7 年前
        1
  •  0
  •   anubhava    7 年前

    如果你在里面的话 myotherdomain 文件夹,则可以将此规则与从当前目录加载的目标中的相对路径一起使用:

    RewriteRule ^Information/?$ info20123.php [NC,L]