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

Digital Literacy

Creating clean URL's with a static site.

I just uploaded my personal site for the first time, and I want to have clean urls, like benschnell.com/blog instead of benschnell.com/blog.html.

I know it has something to do with .htaccess, but do I need to link the .htaccess file from hmtl or somewhere else in my project?

Do I just upload the .htaccess to my root directory?

1 Answer

There are three ways I know of doing it. One is to use rewrite rules in .htaccess. Another is to have a subfolder with the name of each clean URL and rename every html or php file index.html or index.php. The final way is to use the Slim framework. The first two methods are covered in the second course on building a website in the PHP section. The final one has its own course in PHP.

Thanks Ted! I'll look into those methods and try it out.