Link to home
Start Free TrialLog in
Avatar of sandhya01
sandhya01

asked on

Redirection setting in php/Apache

Hi experts,
I am really stuck in this. please help.

I have a php application deployed in a Apache server. The apache server does not have mod_rewrite module installed. My application has a login.php file and other application specific php files.
Now my application requires that if a user tries to access any of the php files directly, using the url, there should be some kind of setting by which he should be redirected to the login.php file and once the user logs in, he may access any of the other files directly.

(1) can you please advice my as to how this can be implemented with apache and php?

Any Help will be highly appreciated.

Thanks
Avatar of cdaugustin
cdaugustin

hi,

simply check if the user is logged in a file thats included in all the other files (maybe the conf file) with the exception login.php
Avatar of sandhya01

ASKER

Hi expert
Thank you for your comments,
 i dont want to touch the other files present in the application.
i want that they should not be able to access my files directly until they are logged in via my login.php page.
Is there any setting in apache/php by which i can mark the files present in an directory as protected and when the user tries to login, they are redirected to my login.php page and once login is successful, that protected setting is changed to unprotected for that directory and user/session and the user is able to login.

Please let me know if there is any

Thanks
hi,

unfortunately if you do not have control of the other files this will prove difficult. If you wanna do it from within php you need to check for login. The only other alternative I can think of is to use apache's auth mechanism go to the following link

http://httpd.apache.org/docs/1.3/howto/auth.html

and search for database auth (its described among the last) but for this you would need to have some apache modules enabled.
the following version is for apache 2.0 (the link in the other comment was for apache 1.3)

http://httpd.apache.org/docs/2.0/howto/auth.html
Thanks cdaugustin.
I am going through your's suggested link and will keep you informed.

Thanks again
Hi Expert,
A better answer could have been to use the function phpinfo() in a php page, and see the details.

Thanks
hi

what does phpinfo() has to do with anything? we were talking about how to auth a user without modif the files ....
ASKER CERTIFIED SOLUTION
Avatar of mirmill
mirmill
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial