views:

56

answers:

7

If you look at the url of the stackoverflow.com you can see that the url is like:

http://stackoverflow.com/questions/ask

or

http://stackoverflow.com/questions/1284899/designing-a-website-for-both-javascript-script-support-and-not-support

or some very popular websites like wikipedia have the same format (en.wikipedia.org/wiki/MySQ)

So what's wrong with old .php .html index.php or index.php?show=ask-question ? what's the point in building the website in this format? better search rank? better surfing?

A: 

Reason 1:

Human readability Way easier to understand /articles/article_title instead of articles.php?article_id=31204513

Reason 2: SEO

I'm pretty sure that most search engines don't really allow querystrings to be indexed. Friendly URLS is one way around that.

espais
A: 

Multiple reasons:

  • Better SERP rankings. Especially a while ago the part behind the ? was more or less ignored by Google and thus made getting your entire website into the index very hard. It has changed, but I guess there still is an advantage
  • Better readability. Those "pretty" URLs make it much easier for a user to understand what the page is about. Posting such a link somewhere for example makes it very easy to guess the contents of a page if it's shaped like your examples
  • Making the URL of a webpage about what it does, not what its technological infrastructure is. Having a .php file in your url does not give any information to a normal user.
  • Leaving information like that out of your url makes moving to a different infrastructure (e.g. switching from PHP to ASP)much easier: Good URLs never change
Jörg
A: 

Search engine optimization. Search engines supposedly look for search keywords in URL-s and give better rank to pages that have them, and rank down "generated" pages (with ?....) and ranks up static pages ...
I say "supposedly" because nobody knows (except someone at google, or bing or whatever search engine) exactly how it works.

Senad Uka
A: 

Depends on the technology. Servlets appear to look like directories. In spring you can specify whatever URL path you want to refer to a controller as well. Newer technologies tend to hid, how they are implemented. Spring does this by using .html extensions. Things like this are done for security reasons, as the less people know about the inards of your website, the better.

Zoidberg
A: 

These sites are using server-site url rewriting rules. Such url is readable and understandable even for no-programmers. Security is increased, too. That way you hide your get parameters, so people can't mess with them and do sql-injection, e.g.

stefita
Untrue! It is still possible to mess with GET and POST values!
espais
A: 

Another reason could be security - you are not explicitly revealing what technology powers the site.

Dan Diplo
just for interest, read my post above ... if you use a proxy you will be able to see what technology powers the site ... if you want even more detail use something like wireshark to see each packet that goes through the wire ...
sillyMunky
+2  A: 

This is more general than just building websites. This is good practice for any large set of files you have to organise. http://stackoverflow.com/ is the root of the web server, the root of the filesystem as far as the web server knows (not over-complicating with virtual hosts e.t.c.). stackoverflow.com/questions/ will go into the directory called questions. Usually these directories will contain index.html or index.php and a bunch of other files|scripts|pages that are required for the main page to run properly.

I don't think it affects your ranking. It only impacts your surfing if you often type exactly what you want in the URL bar rather than clicking on links from the main site. Even then, the impact is minimal. For the administrator/maintainer/developer of the website this system of building using folders and sub-folders is indispensable for any modern website.

sillyMunky
In response to stefita's post, unfortunately security is unchanged. Names of GET and POST parameters are still available by inspecting the page's form elements or putting a proxy (such as burp) between your browser and the web-server. GET parameters are passed in the URL and POST parameters are passed in the request headers. I strongly recommend you get burpSuite, choose it as your proxy in network settings of your browser and watch what actually goes on when you browse web-sites. It can be really enlightening and fun too :)
sillyMunky
thank you for the answer.
EBAGHAKI