How to prevent users from viewing certain pages?
Moderator: General Moderators
How to prevent users from viewing certain pages?
Hi, I need to add some security to some pages and even some directories so users are not able to view them. What do I need to do to prevent users from viewing pages?
Re: How to prevent users from viewing certain pages?
1: try to read something about HTAccess, e.g. Forbidden page
2: If you want to do it in programming aspect, you can add an index.php to each of your dir. Then write if-statement to redirect them to other pages.
Hope this helps
2: If you want to do it in programming aspect, you can add an index.php to each of your dir. Then write if-statement to redirect them to other pages.
Hope this helps
Re: How to prevent users from viewing certain pages?
The method I use to protect directories is the method Morris touched on. Run htpasswd from the Apache BIN directory to encrypt the password. Take the file containing this and put it above the website root, where others cannot access it. Then place an .htaccess file in any directory you want to protect. The contents of this file will look somethng like this:
Here is the url for the htpasswd command line arguments:
http://httpd.apache.org/docs/2.0/programs/htpasswd.html
Code: Select all
authtype basic
authname ADMIN
authuserfile /data/18/1/130/82/78421/user/1745722/cgi-bin/.admin
require valid-userhttp://httpd.apache.org/docs/2.0/programs/htpasswd.html
Re: How to prevent users from viewing certain pages?
use sessions or the other ideas.. if interested post back and I'll provide more info
I didn't want to include too much if you were going with the other ideas.
Hag
PS I only use htaccess to provide a "window" for web clients before their site goes live, everthing else I use sessions
I didn't want to include too much if you were going with the other ideas.
Hag
PS I only use htaccess to provide a "window" for web clients before their site goes live, everthing else I use sessions