从主机服务器上Codeigniter中的URL中删除index.php
大家好,我试图从URL中隐藏index.php,就像这样:
Hi all im trying to hide the index.php from the url, well something like that:
我想要的是:mydomain.com/index.php/mycontroler
i want : mydomain.com/index.php/mycontroler
就像:mydomain.com/mycontroler
to be like : mydomain.com/mycontroler
这是我的.htaccess
here is my .htaccess
Options -Multiviews
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php?/$1 [L]
这是我的conf.php
And here is my conf.php
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
问题是它在本地运行良好,但在服务器中运行不正常
the problem is that it was working good in the local but not in the server
这是我的文件的处理方式
here is the disposition of my files
- bin
- etc
- mail
- public_ftp
- public_html
-- application
-- assets
-- system
-- .htaccess
-- index.php
帮助人
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
$config['index_page'] = '';
htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
如果仍然遇到麻烦,请尝试更改:
if still getting troubles try changing :
$config['uri_protocol'] = 'REQUEST_URI';
to
$config['uri_protocol'] = 'AUTO';
或其他不同的东西(在config.php中,您会找到所有可用于尝试的选项uri_protocol参数)
or somenthing different more (in the config.php you'll find all the options available to try for the uri_protocol param)