如何使用IIS 8.0服务器从url(代码点火器)中删除index.php
我下载了CodeIgniter 3.1.7,并在IIS 8上托管了我的网站。然而由于我一直试图解决的一个令人恼火的问题,我目前处于停顿状态 我的目标是在尝试访问控制器时从url中删除'index.php' 例:代替 因为IIS不使用htaccess文件创建从url中删除“index.php”的规则。我尝试过的另一种方法是使用IIS提供的URL写入加载项 在我点击后应用。将创建web.config文件:如何使用IIS 8.0服务器从url(代码点火器)中删除index.php,php,codeigniter,iis,codeigniter-3,Php,Codeigniter,Iis,Codeigniter 3,我下载了CodeIgniter 3.1.7,并在IIS 8上托管了我的网站。然而由于我一直试图解决的一个令人恼火的问题,我目前处于停顿状态 我的目标是在尝试访问控制器时从url中删除'index.php' 例:代替 因为IIS不使用htaccess文件创建从url中删除“index.php”的规则。我尝试过的另一种方法是使用IIS提供的URL写入加载项 在我点击后应用。将创建web.config文件: <?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{R:1}" pattern="^(index\.php|assets|images|js|css|uploads|favicon.png)" ignoreCase="false" negate="true" />
<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}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
,但我得到了这个信息:
404-找不到文件或目录。您正在寻找的资源
可能已被删除、名称已更改或暂时
不可用
试试这个
在您的.htaccess
文件中
RewriteEngine On
RewriteBase /your_subfolder
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
在application/config/config.php中
$config['index_page'] = '';
更新
很抱歉,我没有看到您使用IIS 8.0服务器
请参阅:首先在此处设置URL帮助程序$autoload['Helper']=array()代码>在application/config/autoload.php中
然后在这里设置您的基本URL,如下所示
$config['base_url'] = 'http://localhost/example_project'
或
现在运行应用程序http://localhost/project-folder-name
第一次确保$config['index\u page]=''代码>
之后,请尝试此.htdocs
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Index.php删除CodeIgniter中的HTTP到https重定向。制作
web.conig文件和put代码。
可能存在的副本
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Index.php remove and HTTP to https redirect in CodeIgniter. make
web.conig file and put code.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<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>
<!-- redirect non http to https -->
<rule name="www redirect" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^[^\.]+\.[^\.]+$" />
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://www.{HTTP_HOST}/{R:0}" />
</rule>
<rule name="www redirect https" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^[^\.]+\.[^\.]+$" />
<add input="{HTTPS}" pattern="on" />
</conditions>
<action type="Redirect" url="https://www.{HTTP_HOST}/{R:0}" />
</rule>
<!-- redirect non http to https -->
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>