大家好,我试图从URL中隐藏index.php,就像这样:
Hi all im trying to hide the index.php from the url, well something like that:
我想要的是:mydomain/index.php/mycontroler
i want : mydomain/index.php/mycontroler
就像:mydomain/mycontroler
to be like : mydomain/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'] = ''.$_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)
更多推荐
从主机服务器上Codeigniter中的URL中删除index.php
发布评论