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 trialCaroline McQueen
1,910 PointsPassword protected pages not working
Hi,
I've created a password protected page for my Testimonials Page as described in Zac Gordon.
There doesn't seem to be a definitive solution for this problem on the Wordpress forum. People suggested turning off the plugins and turning them back on again but that had no effect.
10 Answers
Caroline McQueen
1,910 PointsHere's how to fix the problem (solved by Zac Gordon).
Add the following lines of code to the wp-config file after line 28, below "define DB_Host":
define('WP_HOME', 'http://www.yoursite.com'); // no trailing slash
define('WP_SITEURL', 'http://www.yoursite.com/folder'); // no trailing slash
Matt Campbell
9,767 PointsHave you got a link to the site, the plugin and what plugin or code are you using?
Michael Sheaver
2,751 PointsCan you post the link to this tutorial on password protecting web pages? I need that for some test pages to present to my client.
Caroline McQueen
1,910 PointsI've figured out the problem. The directory where Wordpress is installed is different the Site Address URL, so passwords no longer work.... How annoying :(
Zac Gordon
Treehouse Guest TeacherSo were you able to solve the problem or just figure it out?
Caroline McQueen
1,910 PointsNo, not yet. I can't seem to find a solution.
Caroline McQueen
1,910 PointsRepairing the database didn't work, I'll have to try moving to a new one...
Caroline McQueen
1,910 PointsMoving to a new database didn't work either.
Zac Gordon
Treehouse Guest TeacherDid you try installing a new WP site on the same server and testing to see if password protected pages work with that one? That was the other suggestion that post gave that could determine whether the it is perhaps a hosting issue.
Caroline McQueen
1,910 PointsI tried installing a new WP site on my server, and then on my friend's server who's site also has the same problem and it solve it. So, I'm thinking it may be a hosting issue too as both of servers are from the same service provider.
Zac Gordon
Treehouse Guest TeacherAt this point I would contact your hosting provider. Let them know what's up and list out everything you've done (and let us know how it goes!) the should be able to help you out
Caroline McQueen
1,910 PointsI've had a response from my service provider (it's taken 3 days!) and they said to add the following to the .htaccess file where Wordpress is installed:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.co.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.co.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule ^(.*)$ /folder/ [L]
...I've just tried this and it seems it doesn't work.
Zac Gordon
Treehouse Guest TeacherDid you change the example.com part to your URL?
Caroline McQueen
1,910 PointsYes, and I changed the part that says "folder" to the name of the directory where Wordpress is installed on my server. It didn't seem to make a difference to a password protected page.
Zac Gordon
Treehouse Guest TeacherTry pinging your hosting company again. I can't think of something at the moment
Caroline McQueen
1,910 PointsI did but they weren't very helpful. They basically said there's nothing wrong with their servers and I should get in contact with Wordpress :(
Zac Gordon
Treehouse Guest TeacherIf you email me some login information for the site and FTP I can take a look at if for you :)
Caroline McQueen
1,910 PointsThanks!