我该如何删除index.php以便使URL欺骗CI可以被利用?当我删除'index.php'时,它将通过404错误或403错误,即使控制器上存在必需的类。CodeIgniter中的htaccess问题
这里是目前我的根的.htaccess:在config.php文件
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
其他CI规格:
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
的rewrite_module启用。
在httpd.conf中:
<Directory />
Options FollowSymLinks
AllowOverride None
Order Allow,Deny
Allow from all
</Directory>
编辑:要清楚,我可以访问我的应用程序(http://localhost/projectfolder
)的 '主页'。但是,当我访问特定的控制器(http://localhost/projectfolder/admin
)时,它不起作用。但是当主机和控制器之间有一个index.php时(http://localhost/projectfolder/index.php/admin
),它就可以工作。我正在寻求解决之间的'index.php'。
你不能简单地删除index.php作为引导CodeIgniter应用程序/框架。随意将它移动到另一个目录,并指出你的文件根目录。 – 2013-02-22 16:40:25
这将帮助你: http://stackoverflow.com/questions/15017448/how-can-remove-index-php-from-url/15017916#15017916 – 2013-02-23 05:45:07