codeIgniter:去除URL'的index.php' [英] CodeIgniter: removing 'index.php' from URL
问题描述
我已经回答了这个问题previously甚至贴出的答案给它自己。我想大多数的回答问题,但它仍然没有奏效。第一个问题是关于的.htaccess
文件的位置,我应该与应用程序文件夹或里面养吗?而接下来的问题是我应该如何删除的index.php
从URL'?
I have answered this question previously and even posted the answer to it by myself. I tried most of the answered questions, but it still didn't work. The first question is regarding placement of the .htaccess
file, should I keep it with application folder or inside it? and the next question is 'How should I remove the index.php
from URL'?
的.htaccess code:
.htaccess code:
RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
的config.php code:
Config.php code:
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
和可能的话做也建议有关如何自定义TankAuth或任何其他身份验证库,可以更容易一个详细的教程。我使用的是Windows 8.1和WAMP的服务器。
and if possible do also suggest a detailed tutorial regarding how to customize TankAuth or any other authentication library which can be easier. I am using Windows 8.1 and Wamp Server.
任何建议或帮助是AP preciated。
Any suggestion or help is appreciated.
推荐答案
在你的.htaccess文件中使用这样的:
Use this in your .htaccess file:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
地方./你的index.php重写规则之前。
或本
place ./ before your index.php rewrite rule.
or this
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
欲了解更多详情请参考链接: https://ellislab.com /ex$p$pssionengine/user-guide/urls/remove_index.php.html
For more detail refer link:https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html
这篇关于codeIgniter:去除URL'的index.php'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!