0

I want to prevent users from accessing the main page of my website since they have no reason whatsoever unless they authenticate through steam. So I set up a PHP script that redirects you to the login page if you are not signed in. And redirects you away from the login page if you are already signed in.

However this is giving me SEO issues as webcrawlers see a 302 redirect and don't do anything.

What php variable checks if its a webcrawler?

nine
  • 25
  • 5
  • Why is your website set up in a way that the home page is not where users _want_ to go? – Halcyon Jun 06 '17 at 15:46
  • You can verify if the request is made by a web browser! @Halcyon, This behavior is common on systems. The truth is that the correct way is to define the login page, as the homepage, on this cases. – Yulio Aleman Jimenez Jun 06 '17 at 15:51
  • @Halcyon To prevent them from accessing the main site where they are unable to do anything unless logged in. – nine Jun 06 '17 at 15:53
  • @nine consider putting a login form on the main page (or any page for that matter) if you're not logged in. – Halcyon Jun 06 '17 at 15:55
  • @YulioAlemanJimenez you can't reliably detect spiders or bots. What if I used something like Selenium to access your website? I would consider that a bot but I doubt there is a way you could detect it. – Halcyon Jun 06 '17 at 15:57
  • @nine you can use is.js javascript library, to detect what browser is making the request, or even in what plattform. – Yulio Aleman Jimenez Jun 06 '17 at 15:58
  • @YulioAlemanJimenez I can't use js because I'm using php to check whether or not the user is logged in, and using php to redirect them. – nine Jun 06 '17 at 16:05
  • I'm probably going to go with the built in php variable that checks the user agent. Don't know if it'll work. – nine Jun 06 '17 at 16:05
  • @nine, OK, look this link https://stackoverflow.com/a/677434/6107280 – Yulio Aleman Jimenez Jun 06 '17 at 16:08

0 Answers0