Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel REST API“未找到状态404”_Php_Api_Http_Laravel - Fatal编程技术网

Php Laravel REST API“未找到状态404”

Php Laravel REST API“未找到状态404”,php,api,http,laravel,Php,Api,Http,Laravel,目前,我们有一个Laravel Rest API系统运行在一个Linux服务器中,该服务器运行Apache、PHP和一个远程数据库,即SQL服务器。我的上司要求我创建相同的系统,但使用Windows、IIS和PHP。现在,我已经按照网络中的所有安装说明进行了操作,甚至到达了laravel 5屏幕页面。现在,当我传输laravel文件并在windows中安装它时,过程中没有任何错误。我甚至将我的.htaccess配置导入IIS。然而,当我向API发出请求时,它返回了http状态404错误 这是我的

目前,我们有一个Laravel Rest API系统运行在一个Linux服务器中,该服务器运行Apache、PHP和一个远程数据库,即SQL服务器。我的上司要求我创建相同的系统,但使用Windows、IIS和PHP。现在,我已经按照网络中的所有安装说明进行了操作,甚至到达了laravel 5屏幕页面。现在,当我传输laravel文件并在windows中安装它时,过程中没有任何错误。我甚至将我的.htaccess配置导入IIS。然而,当我向API发出请求时,它返回了http状态404错误

这是我的.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>

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="true" />
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.*)/$" ignoreCase="false" />
                    <action type="Redirect" url="/{R:1}" redirectType="Permanent" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

您必须将htaccess转换为web.config或简单的方式,使用感谢您的建议,但我已经在IIS中将其转换为web.config。然后您应该发布配置文件。htaccess在这里是无用的。在问题中添加了web.config文件