【问题标题】:i can not remove index.php from url in codeigniter in iis server我无法从 iis 服务器的 codeigniter 中的 url 中删除 index.php
【发布时间】:2017-12-21 00:30:13
【问题描述】:

我无法从 IIS 的 url 中删除 index.php。这是我的 .htaccess 文件;

RewriteEngine on

RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

我也尝试了 codeigniter link 的步骤,但它不适用于我的服务器。它仅适用于 apache 服务器。但我使用 iis 服务器。即使我启用了重写模块,但它没有再次工作。

【问题讨论】:

  • 也许您需要web.config 文件?检查this answer
  • 我试过了,但没用..或者我如何输入 web.config ?
  • 谷歌搜索类似“web.config for codeigniter”的内容。
  • 我什至在谷歌兄弟上都找不到..我尝试了所有..我找到了一些.htaccess to web config。但我没有得到..
  • This one?什么错误说?也检查this topic

标签: .htaccess iis codeigniter-3


【解决方案1】:

您应该将其包含在位于项目根目录中的Web.config 中:

<rule name="Remove index" stopProcessing="true">
  <match url=".*" />
  <conditions logicalGrouping="MatchAll">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  </conditions>
  <action type="Rewrite" url="index.php" />
</rule>

【讨论】:

    猜你喜欢
    • 2023-03-25
    • 1970-01-01
    • 2013-08-09
    • 2012-12-27
    • 1970-01-01
    • 1970-01-01
    • 2015-05-26
    • 1970-01-01
    • 2015-06-24
    相关资源
    最近更新 更多