Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 如何删除不同端口上codeigniter中的index.php_.htaccess_Codeigniter_Ports - Fatal编程技术网

.htaccess 如何删除不同端口上codeigniter中的index.php

.htaccess 如何删除不同端口上codeigniter中的index.php,.htaccess,codeigniter,ports,.htaccess,Codeigniter,Ports,使用.htaccess可以轻松删除codeigniter上的index.php RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] 但是什么时候需要在其他端口上?它不起作用,为什么?如何

使用.htaccess可以轻松删除codeigniter上的index.php

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
但是什么时候需要在其他端口上?它不起作用,为什么?如何让它工作

在中似乎可以工作,但在调用控制器时找不到它,例如

然而,同样的.htaccess当部署在托管它们的服务器中时,调用控制器就可以了,因为它没有使用任何不同于80的端口

在config.php和route.php文件中已经设置如下

 $config['base_url'] = 'http://localhost:85/foldersite';
 $config['index_page'] = '';
 $config['uri_protocol']    = 'REQUEST_URI';


 $route['default_controller'] = 'welcome';
 $route['404_override'] = '';

我想我和你有同样的问题,几分钟前我就解决了

请考虑阅读此文档页:在“删除index.php文件”一节中,您将被告知启用了Apachemod_rewrite

然后,我从中实现了一个教程,效果很好。试试看

此外,我还有与您完全相同的
.htaccess
内容。除了,我没有修改
$config['base\u url']
$config['index\u page']中的任何值。


我希望这能有所帮助。

让你在config中设置你的基本url。phpit被设置为$config['base\u url']=''$配置['index_page']=''$config['uri_protocol']='REQUEST_uri';同时显示route.php$route['default_controller']='welcome'$路由['404_覆盖']='';好的,试着像这样设置你的基本url
$config['base\u url']='http://localhost/foldersite/';和访问url
http://localhost/foldersite/
http://localhost/foldersite/welcome/