简体   繁体   English

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

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

I'm working on web application. 我正在开发Web应用程序。 In which I'm facing issue with index.php on redirect. 在这种情况下,我在重定向时面临index.php的问题。 When even I'm submitting form to controller and redirecting to another page index.php added to URL automatically after domain name. 当我什至要向控制器提交表单并重定向到另一个页面index.php后,域名后会自动将其添加到URL。

eg 例如

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

and page shows string "No input file specified." 和页面显示字符串“未指定输入文件”。 On localhost it works very fine. 在本地主机上,它可以很好地工作。 Do I have some issue with hosting or with code ? 我在托管或代码方面有问题吗? Any Idea ?? 任何想法 ??

There are few things you need to set in order to make it work properly 您需要进行一些设置才能使其正常运行

Make sure in your application/config/config.php file index_page is set to empty 确保在您的application/config/config.php文件中index_page设置为空

$config['index_page'] = '';

The .htaccess file for removing index.php from the url's .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]

If your site is not in the root directory you may need to change this line to RewriteBase /folder_name where folder_name is the name of the folder in which you have placed your site 如果您的站点不在根目录中,则可能需要将该行更改为RewriteBase /folder_name ,其中folder_name是您放置站点的文件夹的名称

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

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