简体   繁体   English

IIS 6重定向目录到index.php?

[英]IIS 6 Redirect Directory To index.php?

I developed a PHP web application under Apache and am currently in the process of moving it to a server running IIS 6. Whenever I use this application on an Apache server typing this: 我在Apache下开发了一个PHP Web应用程序,目前正在将其移动到运行IIS 6的服务器上。每当我在Apache服务器上使用此应用程序时,请输入以下内容:

http://mysite.com/subpage/

would internally redirect to: 将在内部重定向到:

http://mysite.com/subpage/index.php

Is there a way within IIS 6 to replicate this same behavior? IIS 6中是否有一种方法可以复制相同的行为? Simply typing a link without index.php give me a director listing denied error. 只需键入不带index.php的链接,即可获得导演列表拒绝错误。 I am not a server administrator, and thus do not have the ability to install an extensions, if they are needed. 我不是服务器管理员,因此无法安装扩展(如果需要)。

Thank you for your time 感谢您的时间

On IIS 6 (been a while since I used it) I believe you can set the Default Document in either the application pool setting or the application itself. 在IIS 6上(自从我使用了一段时间后),我相信您可以在应用程序池设置或应用程序本身中设置默认文档。

In the Default Document properties box, there is a listing of file names and extensions you can set it to load automatically. 在“默认文档”属性框中,列出了文件名和扩展名,您可以将其设置为自动加载。 They are in descending order of priority. 它们的优先级从高到低。 You'll want to add index.php to the list and move it to the top. 您需要将index.php添加到列表中并将其移到顶部。

This will make it so any time you go to a "bare" directory, like http://www.example.com or http://www.example.com/subpage/ it will load up index.php. 这样一来,无论何时您转到“裸”目录(例如http://www.example.comhttp://www.example.com/subpage/) ,都会加载index.php。

If you're trying to do it without administrative access, you can add a Default Document section to your web.config file which then gets used. 如果您尝试在没有管理访问权限的情况下执行此操作,则可以将默认文档部分添加到web.config文件中,然后使用该文件。 http://www.iis.net/ConfigReference/system.webServer/defaultDocument http://www.iis.net/ConfigReference/system.webServer/defaultDocument

As others have answered, if you have direct access to IIS you can set the Default Document. 正如其他人回答的那样,如果您可以直接访问IIS,则可以设置默认文档。

Without having admin access, you can probably just take advantage of IIS' defaults. 没有管理员访问权限,您可能就可以利用IIS的默认设置。 Make a page called "Default.htm" (or "index.htm") that redirects to index.php. 制作一个名为“ Default.htm”(或“ index.htm”)的页面,该页面重定向到index.php。 Since those are already set as default documents it should work. 由于这些已经设置为默认文档,因此它应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM