【问题标题】:404 - File or directory not found. Codeigniter on windows server [closed]404 - 找不到文件或目录。 Windows 服务器上的 Codeigniter [关闭]
【发布时间】:2019-02-02 09:32:23
【问题描述】:

我将我的 codignter 网站上传到 Windows 服务器。主页工作正常,但所有其他链接和页面都显示

服务器错误 404 - 找不到文件或目录。 您要查找的资源可能已被删除、名称已更改或暂时不可用。 这是我的 htaccess 文件

<IfModule mod_rewrite.c>
Access-Control-Allow-Origin:*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<FilesMatch ".(ttf|otf|eot|woff|woff2)$">
<IfModule mod_headers.c>
Allow from all
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>

它适用于 Linux 服务器 请帮忙。

【问题讨论】:

标签: php windows codeigniter live


【解决方案1】:

制作文件web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<system.webServer>

    <httpErrors errorMode="Detailed" />
    <asp scriptErrorSentToBrowser="true"/>

    <rewrite>
    <rules>
        <rule name="RuleRemoveIndex" stopProcessing="true">
            <match url="^(.*)$" ignoreCase="false" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
        </rule>
    </rules>
    </rewrite>

</system.webServer>

<system.web>
    <customErrors mode="Off"/>
    <compilation debug="true"/>
</system.web>

</configuration>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-23
    • 2011-02-07
    • 1970-01-01
    • 2021-01-31
    • 2020-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多