删除" index.php "来自网址使用说明here,
的说明
当我调用与子文件夹同名的codeIgniter控制器时,请求cPanel子文件夹。
控制器和子文件夹名称是" sites"。所以,当我要求
时example.com/sites
不是请求控制器 example.com/index.php/sites ,而是请求子文件夹" 网站"。
可以通过删除子文件夹或重命名控制器来修复它,但我想知道是否有其他解决方案来解决此问题。
谢谢!
答案 0 :(得分:1)
你可以通过htaccess规则来做到这一点。
尝试此规则: -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
// Below line will controller instead of directory
RewriteRule ^sites/?$ index.php/sites [L]
OR
RewriteCond %{REQUEST_URI} !^/sites
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
希望它会对你有所帮助:)。