Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

Christopher Montolio
Christopher Montolio
794 Points

HELP: How can I get rid of my url extensions

I am using Dreamweaver CS6. I have my website up and running but the only problem is my pages have extensions at the end of them.

For Example

www.example.com/about.html

www.example.com/menu.html

www.example.com/contact.php

How can I make it to where it looks like this

www.example.com/about

www.example.com/menu

www.example.com/contact

Is this something you can do in Dreamweaver?

Many Thanks!

1 Answer

Kevin Korte
Kevin Korte
28,109 Points

It's pretty easy to do, but it has nothing to do with dreamweaver.

In your root directory, you will need to make sub folders such as menu, about, and contact.

Than, take your about.html and rename it index.html. Take your menu.html and rename it index.html, and take your contact.php and rename it index.php. You want to put each of these new index files into the correct subfolder, so it would probably be smart to do them one at a time.

Now make sure you have updated all of your links, because most likely you will have broken links!

Why does the work? Browsers will look for the index file automatically! Thats is why your home page is www.example.com; you don't need to give the browser www.example.com/index.html even though that would also be correct.

Randy actually does just this in a chapter of his PHP application.

If you're confused, you can (and I would suggest) at least watching that chapter found here:

http://teamtreehouse.com/library/programming/enhancing-a-simple-php-application/cleaning-urls-with-subfolders

Christopher Montolio
Christopher Montolio
794 Points

Great! Thank you so much Kevin! I'll def try it out

Kevin Korte
Kevin Korte
28,109 Points

No problem Chris! What you want to do is certainly worth doing, and it should be fairly easy. Good luck