Man kan bruge htaccess til at forbyde eller tillade adgang til en hjemmeside ved brug af IP adressen.
]]><span style="background-color: #eff0f1; color: #242729; font-family: Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;"><span style="font-family: Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;">order deny,allowdeny from allallow from <your ip> </span></span>(bemærk at der IKKE er mellemrum efter komma foran "allow") !!!
tilføj også:
allow from yourIPv6
(Det kan ske, at filen .htaccess (punktum foran kræves) ikke er tilgængelig for browseren eller at serveren ikke er konfigureret til at forhindre browser-adgang til .htaccess )
Send den besøgende til en url hvis deres adgang er blevet nægtet:
]]><span style="background-color: #eff0f1; color: #242729; font-family: Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;"><span style="font-family: Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;">ErrorDocument 403 /specific_page.htmlorder deny,allowdeny from allallow from 111.222.333.444</span></span>eftersom "order deny,allow" formen vil blive forbudt engang i fremtiden er det bedre at bruge denne form:
]]><span style="background-color: #eff0f1; color: #242729; font-family: Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;"><span style="font-family: Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;"><RequireAll> Require ip xx.xx.xx.xx yy.yy.yy.yy</RequireAll></span></span> IP adresser er på formen: xxx.xxx.xxx.xxx og hvert af de fire tal er 0-255.
You can use the following in htaccess to allow and deny access to your site :
]]><span style="background-color: #eff0f1; color: #242729; font-family: Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;"><span style="font-family: Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;">SetEnvIf remote_addr ^1.23.4.5$ allowedip=1 Order deny,allowdeny from allallow from env=allowedip</span></span>We first set an env variable allowedip if the client ip address matches the pattern, if the pattern matches then env variable allowedip is assigned the value 1 .
In the next step, we use Allow,deny directives to allow and deny access to the site. Order deny,allow represents the order of deny and allow . deny from all this line tells the server to deny everyone. the last line allow from env=allowedip allows access to a single ip address we set the env variable for.
Replace 1.2.3.4.5 with your allowed ip address.
Refrences :
- https://httpd.apache.org/docs/2.4/mod/mod_setenvif.html
- https://httpd.apache.org/docs/2.4/mod/mod_access_compat.html
Man kan indsætte delvise IP adresser for at blokere større blokke af adresser:
1.2.3.4
Blokerer en bestemt IP adresse 1.2.3.4
1.2.3.
Blokerer 1.2.3.0 til 1.2.3.255 (dvs. 1.2.3.xxx)
1.2.
Blookerer i området 1.2.xxx.xxx
1.2
Blokerer i området 1.2xx.xxx.xxx
Tegn abonnement på
BioNyt Videnskabens Verden (www.bionyt.dk) er Danmarks ældste populærvidenskabelige tidsskrift for naturvidenskab. Det er det eneste blad af sin art i Danmark, som er helliget international forskning inden for livsvidenskaberne.
Bladet bringer aktuelle, spændende forskningsnyheder inden for biologi, medicin og andre naturvidenskabelige områder som f.eks. klimaændringer, nanoteknologi, partikelfysik, astronomi, seksualitet, biologiske våben, ecstasy, evolutionsbiologi, kloning, fedme, søvnforskning, muligheden for liv på mars, influenzaepidemier, livets opståen osv.
Artiklerne roses for at gøre vanskeligt stof forståeligt, uden at den videnskabelige holdbarhed tabes.
Recent Comments