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

时间:2018-11-30 16:07:48

标签: .htaccess

例如,我使用htaccess解耦实际的域名文件名

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

对于顶级文件夹中的域myxyzdomain.com来说,它工作得很好。

我还有第二个顶级文件夹

/myotherdomain

,我想对它的URL做同样的事情:

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

URL MyOtherDomain.com/Information

但这不起作用。我收到“多选”错误,但错误详细信息仅显示一个选择。错误提示:

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 个答案:

答案 0 :(得分:0)

如果您在<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <div class="container" style="background:white"> <div class="row"> <div class="col-xs-2 bg-warning"> <h4 style="background:whitesmoke;">First Left Heading</h4> </div> <div class="col-xs-10 bg-info" style="padding-top:10px;"> <p>first paragraph</p> <p>Second paragraph</p> <p>Third paragraph</p> <p>Four paragraph</p> <p>Five paragraph</p> </div> </div> </div>文件夹中有.htaccess,则可以将此规则与从当前目录加载的目标中的相对路径一起使用:

myotherdomain