|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
apache config
assume that i have a file called index.php,a user must login first to gain access of the index.php page,how can i config my apache so that people cannot type the path http://localhost/index.php to access it?
thanks! |
|
#2
|
||||
|
||||
|
RE: apache config
It depends. What kind of login do you use? HTTP authentication or a session-based one made with PHP? If you're using a login system made with PHP, you'll have to solve the problem by modifying the script so that it shows an error if the user hasn't logged in (no changes to Apache config.)
If you're using HTTP authentication, Apache is already configured to do this |
|
#3
|
|||
|
|||
|
RE: apache config
Majing,
This is easily done with a .htaccess file. You can protect an entire directory with this. first create the password file in the base directory. -c tells it to create the file. This will prompt you for a password note I added your username. To add users to the file just use it without the -c Code:
htpasswd -c /var/home/your_dir majing Then create a file called .htaccess. Below is the basics of what is required in it. Code:
AuthName "Restricted Directory" AuthType Basic AuthUserFile /var/home/your_dir require valid-user |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > apache config |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|