【发布时间】:2014-11-21 04:09:40
【问题描述】:
在重定向页面时我是 codeigniter 的新手 index.php 默认情况下不会加载,所以我在 htaccess 文件中尝试了以下代码。我已经安装了 php 5.3.10、apache 服务器和 postgres 数据库。因此,如果除了更改 .htaccess 和 httpd.conf 之外还需要进行任何新配置,请告诉我。我已经看到以前针对同一问题提出的问题,并且我参考了这些问题中的所有内容,但我仍然无法解决这个问题。请让我知道需要做哪些额外的事情。
.htaccess 文件
<IfModule mod_rewrite.c> RewriteEngine On #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #This last condition enables access to the images and css folders, and the robots.txt file RewriteCond $1 !^(index\.php|public|images|robots\.txt|css) RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^/(index\.php|assets/|humans\.txt) RewriteRule ^(.*)$ index.php/$1 [L]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
httpd.conf 文件 服务器名称 localhost
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
【问题讨论】:
-
是否启用了重写模块?
-
确保
$config['index_page'] = '';在application/config/config.php -
检查文件权限 sudo chmod 777 -R projectDirectory/
-
@Pooshonk 先生,我已经引用了该链接,我已经尝试了这些代码,但它仍然无法正常工作。
标签: codeigniter codeigniter-2 codeigniter-url codeigniter-routing codeigniter-3