为什么.htaccessredirect到`default.asp`,它是什么?

这是我的.htaccess文件的内容:

Options MultiViews Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.lventas.com$ [NC] RewriteRule ^(.*)$ http://lventas.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ http://lventas.com/negocio/$1 [L,QSA] ErrorDocument 404 http://www.lventas.com/404.php RewriteOptions Inherit 

当到达根文件夹时,它不应该什么都不做,但它仍然redirect到:

 http://lventas.com/negocio/default.asp 

什么是'default.asp'? 为什么要在那里?

正如@uSlackr在评论中提到的,其中一个父configuration可能包含像这样的指令;

  DirectoryIndex default.asp 

DirectoryIndex指令为客户端请求一个目录提供了一个默认的资源,例如http://www.lventas.com/因此请求被映射到与DocumentRoot相关的文件系统,如REQUEST_FILENAME=/default.asp

但是,由于default.asp不是以文件,目录或链接的forms存在的,它就像这样匹配你的第二个RewriteRule;

 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ http://lventas.com/negocio/$1 [L,QSA] 

所以最终的请求是http://lventas.com/negocio/default.asp

你通常可以像这样覆盖它;

 DirectoryIndex index.php Options MultiViews Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.lventas.com$ [NC] RewriteRule ^(.*)$ http://lventas.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ http://lventas.com/negocio/$1 [L,QSA] ErrorDocument 404 http://www.lventas.com/404.php RewriteOptions Inherit 

或者似乎可能只是像这样取消DirectoryIndex设置;

 DirectoryIndex Options MultiViews ...