Reputation: 1
I have a website set for a couple who are getting married, but they want to keep the website private and accessible only to guests.
I have the index page password protected, but this does not protect any of the other pages on to this website. Now I can of course, password protect every page, but the couple have asked me not to do that, because they don't want their guests typing a password every time the open up a new page.
So is there a way I can hide/block/denied access to all the other pages except the index page or that the index page is the only access point to the website.
Upvotes: 0
Views: 62
Reputation: 4728
Assuming your server runs an Apache web server then ..
Create two files.
.htaccess
and .htpasswd
Within .htaccess
you should put:
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /path/to/.htpasswd
Require valid-user
Make sure you update the path so it points to your .htpasswd
file
Inside the .htpasswd
file you need the valid logins.
e.g.
test:dGRkPurkuWmW2
As the pasword is encryped then use a tool like http://www.htaccesstools.com/htpasswd-generator/ to generate the file for you.
Once you've uploaded both files then a new user will need to log in once and then after this they'll be able to browse the site without re-entering the login details.
Upvotes: 1
Reputation: 5285
It sounds like you want a session - a session lets users sign in once, and then uses a cookie or an authentication token to remember that user x is signed in on the machine that provides the cookie or token. However, it doesn't seem like you should be having to implement these things yourself. It would be helpful to provide more detail in your question about the technologies you're using. As a rule of thumb, you don't want to be implementing passwords, sessions, etc. by yourself.
Upvotes: 1