[英]Codeigniter can't remove index.php
我真的需要帮助,和标题一样,我的问题是无法在我的codeigniter中删除index.php
我尝试了很多.htaccess代码,例如:
// first
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /projectFolderName/ --> i already change to my project name
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
//second
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
//third
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ – [NC,L]
RewriteRule ^(.*)$ index.php/$1 [NC,L]
//fouth
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我已经改变了我的配置
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
在我的httd.conf中有一些参考
<Directory />
AllowOverride All
Require all denied
</Directory>
我将.htaccess移至主项目文件夹(不在应用程序中),但所有方法均无效
您忘记在application/config/config.php
设置base_url
。设置您的base_url
。
$config['base_url'] = 'your_url';
在根文件夹.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
并且
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
在这里工作正常。
有趣的是,我的网址:我的配置中的http:// localhost / Igniter :$ config ['base_url'] =' http:// localhost / igniter '; 你可以和我一样,用链接“ igniter”检查URL替换“ Igniter”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.