How does Code Igniter know that index.php is not a directory?
My Code Igniter app has urls like this:
开发者_JAVA百科http://servername/contexttroot/index.php/Sessions/login/
My question is, when the url is parsed how does Apache know that there isn't a folder called index.php? If I were the parser, that's what I would be looking for :)
I know it works and CI's index.php gets called but I don't understand how this works. Maybe dots aren't allowed as part of directory names?
UPDATE See the comments on the accepted question for details, there are lots of details to what I am asking.
CodeIgniter basically performs rewrites of the URL by searching for the index file name "index.php" in your URL. Look in CI's config file for this line:
$config['index_page'] = "index.php";
Try changing that to something else and see if it still works.
Edit: OK, to answer the question Juan posed, the way Apache knows that index.php isn't a directory is because a file and directory can't have the same name in the same directory. If index.php were simply a directory, Apache would go into it and search further. If it is a file, it will run the file.
精彩评论