CodeIgniter Forums
remove index.php from view controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: remove index.php from view controller (/showthread.php?tid=77439)



remove index.php from view controller - nickpsal - 09-02-2020

Hi i am new at codeigniter 4  i have installed but when i tried to access controller home with https://projects.information-ts.com/codeigniter4/public/home i take error "No input file specified."  but when i try like this https://projects.information-ts.com/codeigniter4/public/index.php/home it works. How can i remove the index.php from url???
I change the 
PHP Code:
public $baseURL 'https://projects.information-ts.com/codeigniter4/public'
PHP Code:
public $indexPage ''



RE: remove index.php from view controller - InsiteFX - 09-02-2020

Not sure why you are getting that on a live host, but I am Running Windows 10 Pro x64
and I have to add the code below to the .htaccess in the root with index.php to get rid of it.

.htaccess

Code:
# Remove index.php on Windows 10
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ /%1 [R=301,L,QSA]

Otherwise there is something wrong with the way your .htaccess file is setup.


RE: remove index.php from view controller - nickpsal - 09-02-2020

i tried this not working.
On xammp its workd prefect on plesk server i have this issue


RE: remove index.php from view controller - jreklund - 09-02-2020

Most likely need to change this line:
https://github.com/codeigniter4/CodeIgniter4/blob/develop/public/.htaccess#L34

Into:
Code:
RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA]



RE: remove index.php from view controller - nickpsal - 09-02-2020

(09-02-2020, 07:20 AM)jreklund Wrote: Most likely need to change this line:
https://github.com/codeigniter4/CodeIgniter4/blob/develop/public/.htaccess#L34

Into:
Code:
RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA]
it works thanks