Welcome to the Treehouse Community
Looking to learn something new?
Isaac Asante4,752 Points
Removing file extension on live server
Hi, so at the end of the How To make a website course, we uploaded our website to the server, but the index, about and contact pages all had their .html file extension in the address bar when they were clicked on through the live site's menu. However, most real sites' pages would only have paths like /contact, /about, instead of /contact.html, and so on... How do we remove the extension from the address? Is this thought in next tutorials?
Alex Heil53,534 Points
hey isaac, this is actually a little bit tricky. to remove the file extensions and leave the current structure in place you would need something called "rewrite rules" handled in your htaccess file on the server.
another option would be to use folders for this. as example, if you create a folder called contact, put your contact.html file in there and then rename the file from contact.html to index.html you would achieve the same effect. but this means you need to change your links etc.
more informations about re-write rules can be found in the 3rd chapter of the php tutorial if you're interested here: http://teamtreehouse.com/library/enhancing-a-simple-php-application-2
hope that helps ;)