我已经在我的服务器上安装了 Codeigniter,并在上面安装了 Grocery crud。不幸的是,服务器是基于 Windows 的,不支持 url 重写,我被困在使用 Grocery crud 的情况下。
有人可以解释解决方案吗,因为我搜索杂货杂货论坛并一无所获。
问候
我已经在我的服务器上安装了 Codeigniter,并在上面安装了 Grocery crud。不幸的是,服务器是基于 Windows 的,不支持 url 重写,我被困在使用 Grocery crud 的情况下。
有人可以解释解决方案吗,因为我搜索杂货杂货论坛并一无所获。
问候
更改 CodeIgniter 中的配置文件并更改 $config['querystring'] = false
现在您可以访问 GroceryCrud 库函数,例如 www.example.com/index.php/ControllerClass/FunctionName
创建一个以web.config
Web 根目录命名的文件并将以下内容放入文件中
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to index.php">
<match url="index.php|robots.txt|images|test.php" />
<action type="None" />
</rule>
<rule name="Rewrite CI Index">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
以上是这里Codeigniter 论坛上使用的示例。
您可能还需要确保将$config['uri_protocol']
其设置为AUTO