Php codeigniter mod_重写工作仅限本地

Php codeigniter mod_重写工作仅限本地,php,apache,.htaccess,codeigniter,mod-rewrite,Php,Apache,.htaccess,Codeigniter,Mod Rewrite,我上传网站时遇到问题,使用codeigniter框架编写 正如文档所说,我必须更改.htaccess RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] 并通过从“index_页面”中

我上传网站时遇到问题,使用codeigniter框架编写

正如文档所说,我必须更改.htaccess

RewriteEngine on 
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
并通过从“index_页面”中删除index.php来更改Config.php

$config['index_page'] = '';
它在localhost@localhost/myapp上运行良好

当上传重写模式不工作时,我必须在所有代码中返回index.php

example.com/myapp/index.php/controller/action

我尝试过不同的访问方式,但没有人解决它

更新:


我上传的服务器是windows server,是否需要在IIS上将.htaccess转换为web.config?首先,确保重定向正常。在项目根目录(aka)中创建一个空白的.htaccess文件,其中仅包含以下内容:

# This allows you to redirect your entire website to any other domain
Redirect 302 / https://www.google.com/
在浏览器中访问你的应用,如果你没有立即重定向到Google,那么你的web服务器处理.htaccess重定向时出现问题

如果你被重定向到谷歌,那么重定向是有效的。请改为在.htaccess文件中尝试以下操作:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
编辑:对于IIS,您需要从以下位置将web.config文件修改为类似的内容:



确保已将mod_rewrite加载到您的其他计算机上server@TunaMaxx我已经查过了,但帮不了我的忙case@JonLin我在Godaddy上上传,上面说服务器上启用了mod_rewrite,我尝试过,但没有帮助,我发现我上传的服务器是windows server而不是apache:(,通过IISWorked over Goddady Apache服务器配置它的任何替代方法
<rewrite>
  <rules>
    <rule name="Rule" 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" />
        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite>