Reputation: 9017
This is just a curiosity. I've seen this couple times:
http://www.website.com/index.php/en/contacts.html
What is a reasoning behind this logic? Why do we have php file followed by html file?
Upvotes: 1
Views: 72
Reputation: 60516
In PHP (And I believe other server side language), you can get the path after index.php
by referring to the superglobal $_SERVER['path_info']
in this case the value is
/en/contacts.html
, you can then process the path in your application as however you see fit (for instance in MVC, /users/list
, you'd initialize users
controller and run list
action on it)
Upvotes: 1
Reputation: 1549
This is most likely using a framework that includes some routing mechanism. The index.php takes in /en/contacts.html as a parameter, retrieves the appropriate file(s) and processes them based on pre-determined rules.
In most cases a rewrite rule is used in Apache or Nginx (or whatever webserver is being used) so the url can be in the form:
http://www.website.com/en/contacts.html
Then everything following the root is interpreted as a parameter in index.php.
Upvotes: 1
Reputation: 324640
Some people find it easier to have a single index.php
file that includes (among other things) things like connecting to the database, the basic layout of the page (navigation, footer, etc.) and suchlike, then have it include the actual file (in this case /en/contacts.html
) inside it.
Personally, I think this is a bad idea because there are so many better ways to do this. One of them being the auto_prepend_file
and auto_append_file
options in php.ini
.
Upvotes: 1
Reputation: 4821
Impossible to tell for sure, but I'd bet on the "en/contacts.html" being the path to the file for index.php to include (super bad practice). Do not use this syntax of URLs, as they aren't user nor search-engine friendly.
Upvotes: 1