繁体   English   中英

Web服务器上Codeigniter 2.1的index.php问题

[英]index.php issue with codeigniter 2.1 on web server

我正在开发Web应用程序。 在这种情况下,我在重定向时面临index.php的问题。 当我什至要向控制器提交表单并重定向到另一个页面index.php后,域名后会自动将其添加到URL。

例如

http://mydomain.com/index.php/contro/func

和页面显示字符串“未指定输入文件”。 在本地主机上,它可以很好地工作。 我在托管或代码方面有问题吗? 任何想法 ??

您需要进行一些设置才能使其正常运行

确保在您的application/config/config.php文件中index_page设置为空

$config['index_page'] = '';

.htaccess文件,用于从网址的网址中删除index.php

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

如果您的站点不在根目录中,则可能需要将该行更改为RewriteBase /folder_name ,其中folder_name是您放置站点的文件夹的名称

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM