1

Currently I'm able to put WAMP online and access all my projects from other devices using the host IP address.

But what displeases me is the fact that even from other devices, the server's index file which shows the list of all the projects is also accessible. What I want is to be only able to view it from local machine, not from others. Others can only access the index files found in the projects not the one on the root server.

I have tried to set some values in httpd.conf files. But not successful. I searched for this issue on the net, but found different ones.

1 Answers1

1

the server's index file which shows the list of all the projects is also accessible. What I want is to be only able to view it from local machine, not from others. Others can only access the index files found in the projects not the one on the root server.

From your comments, it would seem you are referring to the physical file index.php residing in the document root of the site (as opposed to an auto generated directory index). However, you want to permit public access to index.php files located in subdirectories (projects?).

You can do this in a number of ways, depending on your specific config and Apache version. I assume you are editing the main server config or relevant VirtualHost container.

One way is to use mod_rewrite. For example:

RewriteEngine On
RewriteCond %{REMOTE_ADDR} "!=203.0.113.111"
RewriteRule ^/(index\.php)?$ - [F]

Where 203.0.113.111 is whatever your local IP address is (or whatever IP address you are accessing the site from).

This will serve a 403 Forbidden for all other users trying to access index.php in the document root only.

MrWhite
  • 43,224
  • 4
  • 50
  • 90