Is it possible to remove index.php without using .htaccess?
No. it is something beyond php or codeigniter, its a server thing.
Why ?
What happens when user try to go to localhost/codeigniter/welcome/index
?
MVC basically hide all your php files inside its folders. and present only one way for any user to interact with your code through index.php
what happen is
- HTTP request to your website directed to index.php
- index.php load codeigniter bootstrap and call codeigniter router
- router look up the url typed (welcome/index) then go fetch the file welcome from inside controller folder and call index function.
this is plain simple what all MVC frameworks do, hide your code and use a single front file to handle all requests and redirect them using a router class.
so if you want to hide
index.php then you need to find a way to tell your server to simply redirect any call to index.php.
index.php is the access door for your website, and your server need to know that all requests must be sent to it. some way or another, and thats why index.php/ must exisit in ur url or use some server configuration to redirect calls to it. but it is always loaded
routes
,it will still work, BUTindex.php
will still appear on the url,htaccess
gives you the pretty url you want and removes theindex.php
on every request depending on what is defined on you'rehtaccess
rules – HangoverRewriteBase
property in .htaccess. sometimes i dont have authority to change that :( @Crossed – Winoindex.php
from URL by routes? And my routes is not working. for example, i have a controllerhome
and i will browse it like sitename/home. but it showing not found message. :( – Wino