-3

If user want to access my website from LINUX platform, then website should not access. Can anyone help me to do this?

Danish Anees
  • 11
  • 1
  • 4
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Web Applications Stack Exchange](http://webapps.stackexchange.com/), [Webmaster Stack Exchange](http://webmasters.stackexchange.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww May 28 '18 at 10:37

1 Answers1

0

You will have to check the client's User-Agent header. Be aware that headers can be easily spoofed, so you will never be 100% sure what platform your users come from - if they want to mask this for privacy, to avoid your block or any other reasons.

Similar questions have been asked before: Operating System from User-Agent HTTP Header

Here's a list of User-Agents for Linux specifically: https://developers.whatismybrowser.com/useragents/explore/operating_system_name/linux/

Depending on your server setup, you could check this header and act accordingly either from your website application (e.g. PHP) or in Nginx or Apache .htaccess configuration files.

You might just check the User-Agent header for the presence of Linux (case-insensitive). In a regex that would be /linux/i.

Zoon
  • 1,068
  • 2
  • 11
  • 26