从主机服务器上Codeigniter中的URL中删除index.php [英] remove index.php from the url in Codeigniter on host server

查看:126
本文介绍了从主机服务器上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)

这篇关于从主机服务器上Codeigniter中的URL中删除index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆