0

This is my php code

<?php
$login = new Login();

if ($login->isUserLoggedIn() == true) {
header("Location:logged in.php");

}else{
header("location:notloggedin.php");

exit;
}
?>

Htaccess I know is where the issue lies but I have tried rewrite and redirect neither of which worked. I am totally new to not php and htaccess so even just pointing me in the right direction would be much appreciated.

Htacces says

<files  ~"\.(htaccess|php)$">order        allow     ,denydeny from all </files>
shutterfly
  • 33
  • 2
  • 9

2 Answers2

0

To begin with you seem to have a typo in your code header("Location:logged in.php");

should be header("Location:loggedin.php");

never use empty spaces in filnames on unix, I presume you are on unix and not windows? It's good practice apart from that.

TinaFrieda
  • 171
  • 3
  • 15
  • That was an accident there is not a space. However I am on windows is that why location is not working? It will go to the login page but says you do not have permission to access this page. Any clues on why I am getting this error? – shutterfly Nov 05 '15 at 21:09
  • Well, yes, maybe ... what webserver are you using? Apache or Windows IIS? .htaccess will only work on Apache out of the box. – TinaFrieda Nov 06 '15 at 11:11
  • Tina I have wamp server installed is that the issue? I'm running everything locally right now. Once its online do you think it would work? Thank you for any help or thoughts you can provide. – shutterfly Nov 06 '15 at 14:41
  • Wamp should be okay, it runs Apache ... have you tried turning on php error reporting so that you can perhaps get a better idea of what is going wrong – TinaFrieda Nov 06 '15 at 16:23
  • also you might like to read through this? http://stackoverflow.com/questions/4391530/how-to-use-htaccess-in-wamp-server – TinaFrieda Nov 06 '15 at 16:23
  • Tina I tried the error read out that did not work. I'll try the rewrite again from that link could of been simple missing comma. I'll also try playing with wamp and apache settings. I'll post once it works. Thank you. – shutterfly Nov 07 '15 at 03:14
  • When I uploaded the files to test on our live server it allowed me to add users through the form and it looked like when I log in with a user name and password. It works because the login box disappears but instead of taking me to the logged in user page it just takes me back to the main page with out the login box. Any suggestions on this issue – shutterfly Dec 07 '15 at 19:57
0

I went in and edited the folder to allow access though all users so it worked on my local computer.

shutterfly
  • 33
  • 2
  • 9