After removing " index.php " from URL using instructions described here ,
cPanel sub-folder is requested when I call a codeIgniter controller which has same name as sub-folder.
Controller and sub-folder name is "sites". So, when I request
example.com/sites
Instead of requesting controller example.com/index.php/sites , it requests sub-folder " sites ".
It can be fixed by deleting sub-folder or renaming the controller, BUT I want to know if there is any other solution to resolve this issue.
Thank You!
You can do that via htaccess Rules.
Try this rule:-
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]
Hope it will help you :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.