CodeIgniter Forums
why is www.mydomain.com/index.php/reports/report1 mapped to index.php ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: why is www.mydomain.com/index.php/reports/report1 mapped to index.php ? (/showthread.php?tid=57118)



why is www.mydomain.com/index.php/reports/report1 mapped to index.php ? - El Forum - 02-16-2013

[eluser]Unknown[/eluser]
Hi,

the title says it all. I must have spend 3 hours to find and answer to this question on the internet - I surrender and signed up on this forum to ask Smile

I started working on a project which uses apache2 (with the virtual hosts mod - but i think that doesn't matter) and a standard codeigniter setup. In the DocumentRoot directory is the codeigniter index.php file.

Why is a request like "www.mydomain.com/index.php/reports/report1" not interpreted by apache as try to find in DocumentRoot a directory called "index.php" and in there a directory "reports" and in there a file called "report1".

Everything works fine by the way: the index.php file is called and does its magic.
But out of pure curiosity I would like to know ... why is that ? Smile

Thanks,
Dieter




why is www.mydomain.com/index.php/reports/report1 mapped to index.php ? - El Forum - 02-16-2013

[eluser]Harold Villacorte[/eluser]
You probably have index.php defined as DirectoryIndex in either httpd.conf or .htaccess.


why is www.mydomain.com/index.php/reports/report1 mapped to index.php ? - El Forum - 02-16-2013

[eluser]Unknown[/eluser]
yes there is an entry in httpd.conf (and only there):

<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

However the docu says :"The DirectoryIndex directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the directory name." Hmm .. if I request www.mydomain.com/index.php/reports/report1 should I not request the directory "index.php/reports/report1/" which doesn't exist and that should return a "file not found error" ?


why is www.mydomain.com/index.php/reports/report1 mapped to index.php ? - El Forum - 02-16-2013

[eluser]Harold Villacorte[/eluser]
CI has a couple of nifty classes called uri and router. Together they grab the uri from the $_SERVER superglobal and serve up code based on the uri segments like this - index.php/controller/method/parameter/.