Allow specific users from outside my intranet to access website

6,026

You have several options. You need a way to check that a user has the credentials necessary to access the server or pages on the server. How you want to check those credentials is up to you:

VPN

As 50-3 suggested, a VPN would remove the need to expose your site to the internet. While TeamViewer would work, another alternative is Hamachi. You can create a VPN that connects all the members together as if they were on the same network. You can revoke access to anyone at any time. The software must be installed on your server machine, and on the PCs of the users.

CMS Plugin

If you are running a CMS like Wordpress or Joomla, simply get a plugin that can protect the pages with usernames and passwords.

Certificate

You can generate a self-signed certificate for Apache that will only allow your protected areas to be accessed if the cert is present.

IP Address Whitelisting

Using an .htaccess file, you can restrict access from certain IPs to directories or files using the Order allow,deny function and the Allow from function.

Example:

RewriteEngine on

#The # character denotes a comment.

Order allow,deny

#Main Office
Allow from 12.34.56.789

#Toronto
Allow from 987.654.321.100

#Chicago
Allow from 100.100.100.222

.htaccess Password

You can use .htaccess and .htpsswd file to protect pages or directories. You can add multiple users to this file. This site is lovely and builds these files for you. I notice you described yourself as unfamiliar with all of this so this might be the best option for you. They generate the files for you to download and give you steps on how to get it working.

Share:
6,026

Related videos on Youtube

C.O.D.E
Author by

C.O.D.E

Updated on September 18, 2022

Comments

  • C.O.D.E
    C.O.D.E over 1 year

    I have an intranet website setup at my house. I'm running under XAMPP. Everything works fine. I'd like to give access to specific users in order for them to test the website (private testing) instead of making it available to the internet. Specifically, I want specific users to have private access to my intranet website and others would be denied access to that site.

    I already configured port forwarding on my router. What would be the extra steps I'd need to take?

    • Mostafa Hamed
      Mostafa Hamed over 10 years
      Why not just use something like teamviewer to establish a VPN?
    • C.O.D.E
      C.O.D.E over 10 years
      How would I go about doing this? I'm a complete noob at this
    • Mostafa Hamed
      Mostafa Hamed over 10 years
      It's all point and click in the teamviewer GUI, I can guide my mother through it without dramas. They also have the process documented in there user guide
  • Admin
    Admin over 10 years
    @C.O.D.E Yep, you got it.
  • C.O.D.E
    C.O.D.E over 10 years
    Cool :)! So by doing that, everyone else who`s trying to access my local website will be denied, right :) ?
  • Admin
    Admin over 10 years
    @C.O.D.E Yes, as long as you do it correctly. I edited my answer to include an example. This .htaccess would disallow access to all files and subfolders of the folder it's placed in.
  • C.O.D.E
    C.O.D.E over 10 years
    Dude, you're amazing :). At least, that will give me a head start!! And all I need to do now is to make my local website available on the internet and then i can whitelist the specific users ip addresses :).
  • Mostafa Hamed
    Mostafa Hamed over 10 years
    Great effort here and thanks for the Ref also bookmarking Hamachi, Also would love to see someone from toronto connect -_- did you just smash the numpad?
  • Admin
    Admin over 10 years
    @50-3 Well, it is sequential, but I was obviously a little tired when I entered an IP starting with 987 :)