我是相当新的代码点火器,并且我的所有链接都有这个路径“/文件夹/文件”。因此,我希望当我打电话的链接,它应该显示:允许代码点火器中的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? –