我开发了一个在Windows上使用CodeIgniter的项目。该项目在XAMPP (Windows)和(更新后的服务器上的.htaccess )上工作得很好。我想使用开放曼德利瓦作为发展的目的。如果我使用index.php运行控制器,它就能工作。
我尝试了许多.htaccess规则的例子,链接。但是控制器没有加载。
我试过:无法从index.php URL中删除CodeIgniter、CodeIgniter从url中删除index.php和这个外部链接以及许多其他链接。
Windows机器上的.htaccess代码
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] Linux主机服务器上的.htaccess代码
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]两人都没有在开放曼德利瓦上工作。
.htaccess路径
/srv/www/html/ci/这一页提供:
404错误,并且找不到对象!
我的项目的文件系统路径是
/srv/www/html/ci/application/controllers/ 在浏览器上:
localhost/ci/branch 如果我添加类似的index.php,项目就能工作
localhost/ci/index.php/branch它与http服务器配置有任何关系吗?我需要安装任何软件包吗。此外,我还尝试了一些apache重写引擎的命令。但我得到的错误是未知的命令。
发布于 2015-02-15 16:46:46
检查重写引擎是否为已启用。
如果没有,则启用重写引擎并重新启动服务器。
sudo a2enmod rewrite
sudo service apache2 restart去
/etc/httpd/conf/httpd.conf - for Mandriva
/etc/apache2/apache2.conf - for Ubuntu将AllowOverride None更改为AllowOverride All
代码块:
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All重新启动Apache(httpd)服务。
config.php或其他地方不需要进行任何更改。
.htaccess代码:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]发布于 2015-02-15 12:41:03
请试用以下方法:
RewriteEngine on
RewriteBase /ci/
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L,QSA]然后,在config.php中
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";请确保您的.htaccess位于与index.php相同的目录中。
https://stackoverflow.com/questions/28525870
复制相似问题