我是相當新的代碼點火器,並且我的所有鏈接都有這個路徑「/文件夾/文件」。因此,我希望當我打電話的鏈接,它應該顯示:允許代碼點火器中的URI更改
www.website.com/folder/file
但是當我點擊它,而不是它進入這個:
www.website.com/index.php/folder/file
如何防止這樣的事情發生?我希望它也是相對的。
我需要觸摸配置中的某些東西嗎?
我是相當新的代碼點火器,並且我的所有鏈接都有這個路徑「/文件夾/文件」。因此,我希望當我打電話的鏈接,它應該顯示:允許代碼點火器中的URI更改
www.website.com/folder/file
但是當我點擊它,而不是它進入這個:
www.website.com/index.php/folder/file
如何防止這樣的事情發生?我希望它也是相對的。
我需要觸摸配置中的某些東西嗎?
如果你想從URL中刪除index.php文件,只需按以下步驟操作:
1)創建並行應用保持部 .htacess文件,只需複製過去的下面的代碼:
RewriteEngine On
RewriteBase /CodeIgniter/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
2)改變$配置[ 'index_page']空白在config.php在如下應用程序文件夾:
$config['index_page'] = '';
3)啓用的Apache 「rewrite_module」。
'RewriteBase/CodeIgniter /'哪個版本? –
如果萬一烏爾使用IIS,你需要創建一個名爲web.config文件的根目錄並粘貼以下
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<rewrite>
<rules>
<rule name="RuleRemoveIndex" 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" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
檢查此
在config.php文件
$config['index_page'] = 'index.php';
上的.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
你想從URL中移除的index.php? –