我正在开发网络应用程序。其中我在重定向时遇到 index.php 问题。 当我向 Controller 提交表单并重定向到另一个页面时,index.php 在域名后自动添加到 URL。
例如
http://mydomain.com/index.php/contro/func
页面显示字符串“未指定输入文件。” 在本地主机上它工作得很好。我对托管或代码有疑问吗?有什么想法吗??
最佳答案
为了使其正常工作,您需要设置一些东西
确保在你的 application/config/config.php
文件中 index_page
设置为空
$config['index_page'] = '';
用于从 url 中删除 index.php
的 .htaccess
文件
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
是您放置的文件夹的名称你的网站
关于php - Web 服务器上 codeigniter 2.1 的 index.php 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17261526/