2016-11-26 86 views
0

這是第一次使用CodeIngiter和我有網址訪問問題。 我必須在url中包含index.php來訪問頁面。CodeIgniter htaccess問題在AWS服務器

爲了解決這個問題,我參考了here。 我遵循了所有步驟。

我在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] 

[email protected]:/var/www/html/CodeIgniter$ a2enmod rewrite 
Module rewrite already enabled 

我不能改變所有的AllowOverride None(無)的AllowOverride全部。在/etc/apache2/apache2.conf文件中。如果我這樣做,我甚至無法訪問我的根網址。 我的/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服務器。

但我仍然無法訪問沒有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> 

有人誰擁有類似的問題

回答

0

我的問題解決了,請試試這個。

相關問題