从主机服务器上Codeigniter中的URL中删除index.php

编程入门 行业动态 更新时间:2024-10-27 04:30:34
本文介绍了从主机服务器上Codeigniter中的URL中删除index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好,我试图从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

本文发布于:2023-11-01 17:34:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549964.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:器上   主机   Codeigniter   php   index

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!