Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

OT: The URL is http://code.blender.org/index.php/2013/12/how-blender-starte...

I've never seen "index.php" in the middle of a URL like that. Very quirky.



The web server is configured to use something like mod_rewrite to pass everything after index.php as a query string parameter to index.php. Many sites use this (though most don't do it so nakedly) to make pretty URLs that search engines and users prefer.

Essentially, the request is equivalent to index.php?Article=2013%2F12%2Fhow-blender-started or perhaps index.php?Year=2013&Month=12&Article=how-blender-started.


Actually, you don't need to edit your server -at least with Lighttpd-.

PHP automagically (or is this expected behaviour?) gets the string appended to /index.php for you! Check out the example at http://private.woutervdb.com/examples/url-query/index.php/We...!

I've made no changes to my webserver configuration. Works on Lighttpd on my laptop and webserver, not sure if Apache and IIS do this as well.


It's called PATH_INFO and is part of the CGI spec ("The PATH_INFO variable specifies a path to be interpreted by the CGI script"): http://tools.ietf.org/html/rfc3875#section-4.1.5


They also need the following in the .htaccess:

RewriteRule ^index\.php$ - [L]

RewriteRule . /index.php [L]


It's a useful technique for routing to controllers without needing 'mod_rewrite' installed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: