peeper Posted April 29, 2007 Share Posted April 29, 2007 Hi, Say I have a web application called web-app running on server and it contains an index.php file in the application's root directory. Can anyone explain why PHP passes a URI of the following form http://server/web-app/index.php/extrastuff to the index.php file under the application's root, rather than an index file under the (non-existent) /index.php/extrastuff/ directory? I've looked in the PHP documentation and can't find any PHP URI processing rules that deals with this type of URI. Can anyone point me to resources that explain PHP URI processing behaviour dealing with this stuff, please? Thanks, Peeper. Link to comment https://forums.phpfreaks.com/topic/49197-php-uri-parsing/ Share on other sites More sharing options...
per1os Posted April 29, 2007 Share Posted April 29, 2007 http://www.sitepoint.com/article/search-engine-friendly-urls More or less for search engine friendly, but maybe this will help. I think PHP checks if there is a file present, so let's say I had a a directory called index.php, so my url looks like this: www.mysite.com/index.php/index.php Well if mysite.com has a file in the root directory called index.php that would trump the directory naming convention and php will read that file and add /extrastuff to the query string. If there is no file called index.php but there is a directory than it will look inside that directory. Basically what is happening is index.php shows as a file and anything after that is considered to be part of the query string. It is very nice for search engine optimization. I have never made a directory called index.php so the trumping could be wrong. The best way to find out is to test it yourself. Link to comment https://forums.phpfreaks.com/topic/49197-php-uri-parsing/#findComment-241077 Share on other sites More sharing options...
peeper Posted April 29, 2007 Author Share Posted April 29, 2007 Thanks for that, frost110. The article on search engine-friendly URIs is interesting and goes some way to explain the URI processing rules of Apache + PHP. I have tried a variety of "search engine-friendly" URIs to see how they are processed. However, to ensure I don't miss any tricks, I would really like to see a canonical definition of the rules that PHP (and/or Apache) applies to URIs of the form we're talking about here. Any suggestions or references? Thanks, Peeper. Link to comment https://forums.phpfreaks.com/topic/49197-php-uri-parsing/#findComment-241089 Share on other sites More sharing options...
per1os Posted April 29, 2007 Share Posted April 29, 2007 www.apache.org goto the HTTP section and read the documentation. I am sure it is all there somewhere. In reality it is Apache that you are looking into. I know IIS does not process URL's this way. Link to comment https://forums.phpfreaks.com/topic/49197-php-uri-parsing/#findComment-241096 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.