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

General Discussion

Tricia Martin
Tricia Martin
19,604 Points

Password Protected Page - .htaccess. Help?

Hi, I'm trying to make a password protected page for my client's portfolio. He has some content that he wants to show for an interview, but doesn't want it to be completely public. I found this page on how to restrict access ( http://css-tricks.com/easily-password-protect-a-website-or-subdirectory/ ), however, I'm running into issues saving the .htaccess and .htpasswd files. I have them written and saved as .txt files at the moment, but my Mac won't let me re-name them to .htaccess and .htpasswd. I tried uploading them to his host and renaming the files via Cyberduck, but I get an error there also. I'm not sure if it means anything, but his hosting service is BlueHost.

I'm trying to get this done tonight, as he has to submit the content by tomorrow morning. Any help would be appreciated. Thanks!

3 Answers

Philip Cox
Philip Cox
14,818 Points

Try searching Google for 'how to show hidden files, mac'. There is a command that allows us to manipulate dot files. These are normally hidden for safety. Don't worry, there is also a reverse command to revert back to hiding them. As with all web things you are starting down a big rabbit hole of command line and Apache configuration. Good luck

I think the cmd is; write com.apple.finder AppleShowAllFiles True

But please check first. :)

Tricia Martin
Tricia Martin
19,604 Points

Thank you, Phillip! That solved the problem with saving and uploading the files. Now I just have to figure out how to get them to work lol. I get a 404 error after the password prompt comes up. Boo.

Philip Cox
Philip Cox
14,818 Points

I am familiar with clean URL's thank's to Randy's course here at Treehouse. But as for blocking pages, not quite there yet, sorry. :)

Tricia Martin
Tricia Martin
19,604 Points

I knew I worked with the .htaccess file before but it was so long ago that I did Randy's course that I forgot exactly where it is. I have more time to figure it out now though since my client hasn't been able to get his assets to me yet though so he's just going to find an alternate way to deliver them for his interview. Thanks for your help though, it got me one step closer to getting it all figured out!