2

I recently set up a website with Apache HTTP web server. My problem is that when I visit http://localhost or http://192.168.1.205 (the local IP address assigned statically to my computer) the website loads just fine. However, when the site is accessed from another device in my LAN such as my iPhone or a device outside of the LAN, a 403 forbidden error is shown. I tried placing a .htaccess file in the root directory of my site (C:\wamp64\www) with the following code.

order allow,deny
allow from all
Options +Indexes

However, this didn't work. I'm using WAMP Server version 3.1.4 on a 64-bit Windows 10 installation. My Apache version is 2.4.35.

2
  • 1
    Have you tried putting these statements into the main config file (instead of a .htaccess file)? Often the .htaccess file is ignored or restricted.
    – Attie
    Commented Oct 4, 2018 at 11:25
  • Attie yes, I put them right at the end; it took down the whole server Commented Oct 4, 2018 at 12:06

1 Answer 1

1

The problem is that Apache changed its syntax beginning with 2.4. Change

allow from all

to

Require all granted

There will be a change for

order allow,deny

as well but I'm not sure what that is, since I don't know this stuff well. Check Apache documentation here

15
  • Do you know where abouts in the httpd.conf file this needs to go? Putting it right at the end of the file fried the whole server. Commented Oct 4, 2018 at 13:05
  • Do you have your "allow from all" etc in a Directory directive? You should substitute the "Require all granted" where your "allow from all" is and that should be inside a Directory, like this: <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> Commented Oct 4, 2018 at 13:07
  • Make sure you are not putting "allow from all" where you have the root directory. You don't want to open up everything. Commented Oct 4, 2018 at 13:08
  • Terri Simon I'm using windows, not linux as I said in the question. So will I need to replace /var/www with /wamp64/www? Commented Oct 4, 2018 at 13:33
  • I haven't done this on Windows (sorry I didn't notice it in your post) but that makes sense. Do you have a Directory directive already there, where your "allow from all" is? Could you maybe give a bigger snippet from your file? Commented Oct 4, 2018 at 13:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .