I want to allow to see my localhost project over the LAN using Apache LIMIT directive in .htaccess
my localhost project URL is http://192.68.0.123/myproject
below is the .htaccess
part which cause problem
<Limit POST PUT DELETE>
order deny,allow
deny from all
allow from 192.168.0.0/255
Satisfy any
</Limit>
but it gives error
Server error!
The server encountered an internal error and was unable to complete
your request. Either the server is overloaded or there was an error in
a CGI script.Error 500
192.168.0.123 Apache/2.4.10 (Unix) OpenSSL/1.0.1i PHP/5.5.15 mod_perl/2.0.8-dev Perl/v5.16.3
my error_log is
[Fri Dec 26 11:18:36.183915 2014] [core:alert] [pid 4752] [client
192.168.0.123:38795] /opt/lampp/htdocs/myproject/.htaccess: The specified network mask is invalid.
my work around
-
If I set
allow from 192.168.0.123
it works only for my IP not over LAN -
If I set
allow from 192.168.0-5.0-255
then it works fine (expected)
but only the main page is coming, after login it gives Access forbidden!403
whereas it was advised to use /
on this blog and many other SO answers
Does this (/
to -
) changed into apache 2.4 ?
someone kindly explain the differences of these and proper valid syntax, I didn't find it on Apache documentation.
another issue
When add GET in LIMIT option
<Limit GET POST PUT DELETE>
order deny,allow
deny from all
allow from 192.168.0.0-255
</Limit>
then it gives error everywhere
Access forbidden!
You don't have permission to access the requested directory. There is
either no index document or the directory is read-protected.Error 403 Access forbidden!
errro_log is
[Fri Dec 26 11:34:05.840880 2014] [access_compat:error] [pid 4752]
[client 192.168.0.123:39012] AH01797: client denied by server
configuration: /opt/lampp/htdocs/myproject/
Best Answer
I got the solution from this article
change the line
allow from 192.168.0.0-255toallow from 192.168.0.2/255.255.0.0
and it works with GET also, here is my final
.htaccess