tags:

views:

35

answers:

3

I usually like defining my pages to know exactly what page does what. However, on a number of sites, I see where the filename is hidden from view and I was just a little curious.

Is there any specific benefit of having URLs appear like this:

http://mydomain/my_directory/my_subdirectory/

As opposed to this:

http://mydomain/my_directory/my_subdirectory/index.php

Thanks.

+1  A: 

Some technologies simply don't match url with files. Java Servlet for examples.

Xavier Combelle
+1  A: 

Done correctly it can be better for:

  1. the end user, it is easier to say and remember.
  2. SEO, the page name may just detract from the URL in terms of search parsing.

Note: In your example (at least with IIS) all that may have happened is you've made index.php the default document of that sub directory. You could use both URLs to access the page which could again affect SEO page rank. A search engine would see both URLs as different, but the page content would be the same, resulting in duplicate content being flagged. The solution to this would be to:

  1. 301 redirect from one of the URLs to the other
  2. Add a canonical tag to the page saying which URL you want page rank to be given to.
Paul Hadfield
Thanks Paul. Sorry for the tardy response.
Chuck Ugwuh
+1  A: 

These are not file names. These are URLs. Their goal is to describe the resource. Nobody cares whether you did it in PHP or ASP or typed your HTML in the Emacs. Nobody cares that you named your file index.php. We like to see clean URLs with clear structure and semantics.

Roman Cheplyaka
Seems a bit harsh and not very helpful. Even taking your point about them being just URLs you've not answered as to whether one has any benefit over the other.
Paul Hadfield
Don't clear structure and semantics count as benefits? `index.php` has no semantic value. Your users do not observe the difference between `index.php` and `index.pl`. If one day you decide to rewrite your site in Ruby and Scala, your URLs will either be broken (if you decide to change `.php` to `.rb`) or look silly. (And *index* word itself probably has nothing to do with page contents.)
Roman Cheplyaka