2016-08-24 4 views
0

結果を得るために、URL接尾辞として.htmlまたは/を取得しようとしましたが、失敗しました。Codeigniter URL接尾辞が機能しない

マイconfig.phpマイweb.configマイautoload.phpが...のような

$autoload['helper'] = array('url', 'file'); 
あるような...

<?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> 

です...のような

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

です0

私のURLは、私のようなURLをしたいような...

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

...

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

を示している私はまたthisthisを試みたが、失敗しました。

どうすればよいですか?

+0

site_url

を使用する必要があり、あなたは示すことによって、どういう意味ですか。 .htmlリンクを押すとどうなりますか? –

+0

@ShaifulIslamまず、あなたの答えに感謝します。リンクやヒットの後に '.html'と書いても問題は起こらず、ページを正しく表示/表示します。しかし、 '.html'は自動的に付加されません。 – Raj

答えて

2

リンクを作成するコードはありません。リンクを作成するには、あなたの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 
+0

答えはShaiful Islamありがとうございます。できます。再度、感謝します。 – Raj

関連する問題