Codeigniter URL 后缀无效

Codeigniter URL suffix not working

我尝试了很多以获得结果,即 .html/ 作为 URL 后缀,但失败了。

我的config.php就像...

$config['base_url'] = 'http://localhost/domain/';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '.html';

我的web.config就像...

<?xml version="1.0" encoding="UTF-8"?>
 <configuration>
  <system.webServer>
    <rewrite>
      <rules>
         <rule name="Clean URL" stopProcessing="true">
            <match url="^(.*)$" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
        </rule>
    </rules>
</rewrite> 

我的autoload.php就像...

$autoload['helper'] = array('url', 'file');

我的 URL 显示为...

http://localhost/domain/view_details/get/some_details

我想要 URL 比如...

http://localhost/domain/view_details/get/some_details.html

我也试过 this and this,但失败了。

我该怎么办?

我没有看到您生成 link 的任何代码。要生成 link,您应该使用 site_url

来自你的config.php

echo site_url('test');
//will produce 
//http://localhost/domain/test.html

echo site_url('view_details/get/some_details');
//will produce 
//http://localhost/domain/view_details/get/some_details.html