我尝试删除 Codeigniter 中的索引页
我这样做的第一步 //旧代码
$config['index_page'] = "index.php”
//新更新代码(只需删除index.php)
$config['index_page'] = ""
然后第二步我这样做 在 codigniter 的根目录中创建文件 .htaccess 然后将此代码源放入
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
but it's the same problem and I can't refresh the web page
对于索引页,URL 有效:http://localhost:8089/codeigniter3/index.php/Hello/dispdata 但没有索引页不起作用http://localhost:8089/codeigniter3/Hello/dispdata
您好,管理员, 最后感谢您的帮助,:)
最佳答案
问题是,您将其安装在 /codeigniter3/
这应该可以修复它:
// remove index.php
$config['index_page'] = ""
// Allow installation in a subfolder of your webroot
$config['uri_protocol'] = "REQUEST_URI"
并保留您的重写设置,它们就可以了。
关于php - 如何删除网址中的index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59860504/