Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Isaac Asante
Isaac Asante
4,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?

1 Answer

Alex Heil
Alex Heil
53,547 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 ;)

Isaac Asante
Isaac Asante
4,752 Points

Thanks! I think I'll just keep going till I reach PHP tutorials. It's not so urgent in any case.