使用IIS的Laravel 5的htaccess文件问题


htaccess file issue in Laravel 5 using IIS

我正在IIS上配置Laravel 5。每当我试图访问任何URL,它给出404错误。.htaccess文件有一些问题,所以我使用web.config文件。以下是我的web.config文件代码:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Laravel4" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

这里是我的.htaccess文件代码:

 <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    RewriteEngine On
    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]
    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

我已经把这个文件放在我的根文件夹(公共文件夹),但它仍然不工作。有解决办法吗?

我找到解决办法了。

如果你已经尝试了所有可能的事情来解决。htaccess或web。配置文件问题,再次它不工作比卸载URL重写模块从您的服务器的控制面板,并重新安装它。它肯定会起作用。并且确保你已经为IIS 7安装了URL Rewrite 2.0