Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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 AWS服务器上的CodeIgniter访问问题_Php_Apache_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

Php AWS服务器上的CodeIgniter访问问题

Php AWS服务器上的CodeIgniter访问问题,php,apache,.htaccess,codeigniter,mod-rewrite,Php,Apache,.htaccess,Codeigniter,Mod Rewrite,这是第一次使用CodeIngiter,我有url访问问题。 我必须在url中包含index.php才能访问页面 为了解决这个问题,我在。 我循序渐进 我在config.php上更新为 $config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name'; $config['index_page'] = ''; $config['uri_protocol'] = 'AUTO'; .htaccess根目录下的文

这是第一次使用CodeIngiter,我有url访问问题。 我必须在url中包含index.php才能访问页面

为了解决这个问题,我在。 我循序渐进

我在config.php上更新为

$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
.htaccess
根目录下的文件是

RewriteEngine On
RewriteCond $1 !^(index\.php | assets | images | js | css | uploads | favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]

ubuntu@ip-172-31-28-229:/var/www/html/CodeIgniter$ a2enmod rewrite
Module rewrite already enabled
我不能把所有的AllowOverride None改为AllowOverride all。在/etc/apache2/apache2.conf文件中。如果我这样做,我甚至无法访问我的根url。 我的/etc/apache2/apache2.conf文件如下所示

# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#设置Apache2 HTTPD服务器的默认安全模型。是的
#不允许访问/usr/share和/var/www之外的根文件系统。
#前者由Debian中打包的web应用程序使用,
#后者可用于web服务器提供服务的本地目录。如果
#您的系统正在为/srv中您必须允许的子目录中的内容提供服务
#访问此处或任何相关虚拟主机。
选项如下符号链接
不允许超限
要求全部拒绝
不允许超限
要求所有授权
选项索引跟随符号链接
不允许超限
要求所有授权
#
#选项索引跟随符号链接
#不允许超限
#要求所有授权
#
#AccessFileName:要在每个目录中查找的文件的名称
#获取其他配置指令。另请参见AllowOverride
#指令。
#
AccessFileName.htaccess
我重新启动了apache2服务器

但如果url中没有index.php,我仍然无法访问。
还有什么问题吗?

我的问题通过使用下面的mod_rewrite.c解决了

<IfModule mod_rewrite.c>
    RewriteEngine On
    Options +FollowSymlinks

    # - - - Use for 1and1 - - -
    # RewriteBase /

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

重新启动发动机
选项+FollowSymlinks
#------用于1和1---
#重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L]
有类似问题的人,请试试这个