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

IIS 6重定向目录到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:

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? Simply typing a link without index.php give me a director listing denied error. 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

我在Apache下开发了一个PHP Web应用程序,目前正在将其移动到运行IIS 6的服务器上。 每当我在Apache服务器上使用此应用程序时输入以下内容: p>

  http://mysite.com/subpage/
  code>  pre> 
 
  

会在内部重定向到: p>

  http://mysite.com/subpage/index.php
  code>  pre> 
 
  IIS 6中是否有办法复制同样的行为? 只需键入一个没有 index.php  code>的链接就可以给我一个导演列表拒绝错误。 我不是服务器管理员,因此如果需要,我们无法安装扩展程序。 p> 
 
 

感谢您抽出时间 p> div>

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.

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.

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.

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. 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.

Without having admin access, you can probably just take advantage of IIS' defaults. Make a page called "Default.htm" (or "index.htm") that redirects to index.php. Since those are already set as default documents it should work.