Mike Moore
Mike Moore

Reputation: 7468

Directories after the filename in a URL?

I am updating a PHP-based site and the URL looks like this:

http://www.thesite.com/index.php/what/are/these

Can somebody give me an idea as to what is going on after the index.php? It looks like directories to me, but there are none that I can see with the same names. Is this some sort of URL rewriting?

PS the CMS is Jetbox v2.1

Upvotes: 0

Views: 136

Answers (8)

Syntax Error
Syntax Error

Reputation: 4527

Those are generally used a like GET variables, it's just a way of passing information along with your request. There are a few different ways to implement this but the aim is usually to have cleaner looking urls. I'm confused why they left the index.php in there - it could be a poorly done homebrew attempt. (Not that I have anything against homebrew solutions for common problems - best way to learn IMO)

If you want to figure out more, look for instances in the code where information is needed about which article to pull, etc... See where that information is coming from and work backwards. If you can't figure out how it works from the code then go through .htaccess and look for url rewriting logic.

Upvotes: 0

Eton B.
Eton B.

Reputation: 6281

Yes this is due to a MVC framework being used, such as CodeIgniter

Upvotes: 0

Rowland Shaw
Rowland Shaw

Reputation: 38130

This extra information is passed to the script to do with as it pleases.

In PHP, you can find its value in $_SERVER['PATH_INFO']

Upvotes: 1

funwhilelost
funwhilelost

Reputation: 2010

Probably. You'll want to do the following:

  • Look at the .htaccess file for any RewriteRule directives
  • Look in index.php to see if it's using any $_SERVER variables (like $_SERVER['QUERY_STRING'])
  • Look at the logs to see what files are actually being sent to the client

Upvotes: 1

David
David

Reputation: 218808

MVC routes? It's just a guess, I'm not familiar with any MVC implementation in PHP (haven't used PHP since 4.0).

Upvotes: 0

Paolo Bergantino
Paolo Bergantino

Reputation: 488374

You're usually going to see URLs like these when the host in which the server is running does not support .htaccess but the programmer still wanted to have "pretty urls" - I know for a fact that CakePHP has their URLs look this way in this situation, as does CodeIgniter. It could also simply be manually done, but I'd bet on the author using a framework of some sort.

Upvotes: 1

user268396
user268396

Reputation: 11976

Someone, somewhere, is using $_SERVER['PATH_INFO']. It is a server variable set by e.g. Apache 2 and gives the remainder of the URL after the object (document/script/w/ever) found in URL being served.

Upvotes: 3

Ian Wetherbee
Ian Wetherbee

Reputation: 6099

Yes, that looks like URL rewriting to me. Without more info I can't be more specific.

Upvotes: 1

Related Questions