Domanda

My website http://www.dorsetdesigns.co.uk/ doesn't have .html after it but when i go to "about us page" it has .html on the end?

È stato utile?

Soluzione

By default a web server will display the index.html or index.aspx, or default.aspx page in a folder.

Altri suggerimenti

Use Mod_rewrite to make urls appear anyway you want.

http://httpd.apache.org/docs/current/mod/mod_rewrite.html


I believe adding the following rule to mod_rewrite would remove all .html from urls

RewriteRule ([^.]+)\.html /$1

A very simplified explanation:

Well, back when the web started a few decades ago, servers only "served" static HTML files. That meant you had to add .html to all requests you made. Now we have dynamic content, it changes in real time and file extensions are obsolete.

More on topic to your question, it has to do with what kind of server you are using, how it is configured and how old it is. The extensions (not only html, but also php and aspx to name a few) are now optional.

This is done simply by default documents. If you have default document named like index.html or default.html then anytime you access the root directory (at any level) you will see like that. In the URL example you gave it is same as accessing http://www.dorsetdesigns.co.uk/index.html and they have default document as index.html. URL rewriting is not needed for simple stuff like this.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top