Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.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/2/tensorflow/5.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
Php codeigniter为子文件夹中的所有内容返回404_Php_Wordpress_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

Php codeigniter为子文件夹中的所有内容返回404

Php codeigniter为子文件夹中的所有内容返回404,php,wordpress,.htaccess,codeigniter,mod-rewrite,Php,Wordpress,.htaccess,Codeigniter,Mod Rewrite,在我的开发环境中,Mac OS、Apache、CI应用程序位于WP文件夹中,我的应用程序运行良好。今天我将它部署到服务器Ubuntu服务器、Apache、WP文件夹中的相同CI应用程序以及我尝试返回404页面的所有内容 这是我的app/.htaccess: SetEnv CI_ENV development RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FIL

在我的开发环境中,Mac OS、Apache、CI应用程序位于WP文件夹中,我的应用程序运行良好。今天我将它部署到服务器Ubuntu服务器、Apache、WP文件夹中的相同CI应用程序以及我尝试返回404页面的所有内容

这是我的app/.htaccess:

SetEnv CI_ENV development

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
此服务器中已启用mod_rewrite

在我的config.php中,我已经尝试过:

 $config['base_url'] = 'http://server/app/';

 // problem in both situations
 $config['index_page'] = 'index.php';
 $config['index_page'] = '';

这里怎么了?当我去的时候,我收到一条404信息。如果我转到,我还会收到一条404消息。

尝试删除SetEnv。可以在index.php文件中设置环境

 $route['default_controller'] = "default_controller_here";
对于基本url,请确保index.php页面所在的文件夹级别

/app/应包含应用程序文件夹

对于index_页面,我不会将其设置为空。把它放回'index.php'

在您的htaccess中尝试此功能

 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d

 RewriteCond %{HTTP_HOST} ^yoursite.com [nc]
 RewriteRule ^(.*)$ http://www.yoursite.com/$1 [r=301,nc]
 RewriteCond $1 !^(index\.php|js|img|css|application|robots\.txt)
 RewriteRule ^(.*)$ /index.php/$1 [L]
您可能不需要在RewriteCond中包含应用程序文件夹,但仍可以尝试

确保在/config/routes.php文件中设置了默认的控制程序

 $route['default_controller'] = "default_controller_here";

尝试删除SetEnv。可以在index.php文件中设置环境

 $route['default_controller'] = "default_controller_here";
对于基本url,请确保index.php页面所在的文件夹级别

/app/应包含应用程序文件夹

对于index_页面,我不会将其设置为空。把它放回'index.php'

在您的htaccess中尝试此功能

 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d

 RewriteCond %{HTTP_HOST} ^yoursite.com [nc]
 RewriteRule ^(.*)$ http://www.yoursite.com/$1 [r=301,nc]
 RewriteCond $1 !^(index\.php|js|img|css|application|robots\.txt)
 RewriteRule ^(.*)$ /index.php/$1 [L]
您可能不需要在RewriteCond中包含应用程序文件夹,但仍可以尝试

确保在/config/routes.php文件中设置了默认的控制程序

 $route['default_controller'] = "default_controller_here";
改变这个

在config.php中

$config['base_url']=; $config['index_page']=; $config['uri_protocol']='AUTO'; 然后在.htaccess**中,这应该放在应用程序文件夹的外侧**

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>
也读一下这个

改变这个

在config.php中

$config['base_url']=; $config['index_page']=; $config['uri_protocol']='AUTO'; 然后在.htaccess**中,这应该放在应用程序文件夹的外侧**

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>
也读一下这个

已解决: 我刚刚发现控制器的文件必须有大写字母的名称

已解决: 我刚刚发现控制器的文件必须有大写字母的名称


我也有同样的问题。只需将文件权限更改为644到index.php
当我通过git获取更改时。权限更改为664,因此更改回644。希望这能解决问题。

我也有同样的问题。只需将文件权限更改为644到index.php
当我通过git获取更改时。权限更改为664,因此更改回644。希望这能解决问题。

应用程序是否可以访问web?尝试创建index.html并检查它是否可以正常工作,同时查看虚拟主机文件。您可能需要为url创建一个配置文件。您的站点url是什么?jagad89,我创建的,运行良好。abdulla,这是一个内部网页。您使用的是什么版本的codeigniter,如果您使用的是codeigniter 3.0,请检查所有控制器和模型的首字母是否为大写的example Welcome.php,而不是Welcome.php和model model_something.phpIs app web Access?尝试创建index.html并检查它是否可以正常工作,同时查看虚拟主机文件。您可能需要为url创建一个配置文件。您的站点url是什么?jagad89,我创建的,运行良好。abdulla,这是一个内部网页你用的是什么版本的codeigniter,如果您使用codeigniter 3.0,请检查所有控制器和模型的第一个字母是否为大写的example Welcome.php而不是Welcome.php和model model_something.phpDid u place.htacess文件,如我所述??将您的站点URL提供给我这可以解决问题,但现在视图未按预期加载。您能提供您的站点URL吗?如果我的通过接受或投票来回答这个问题。谢谢你是否如我所说放置了.htacess文件??给我你的网站URL这可以解决问题,但现在视图没有按预期加载。你能给我你的网站URL吗?如果我的回答有用,请接受或投票。非常感谢。