Apache / htaccess

Posted:
in Genius Bar edited January 2014
Hello,



I was wondering if anyone can help me with the following: I would like to deprive access to a Apache WWW server using a new htaccess file.



I don't want anyone having access that is NOT using Mozilla, Netscape, MSIE, and so on.



Can anybody use the following file and have a succeful/stable web server?



RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http://(www\\.)?somesite.net/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http://(www\\.)?some-external-site.com/.*$ [NC]

RewriteRule \\.(gif|jpg)$ <a href="http://somesite.net/nasty.gif"; target="_blank">http://somesite.net/nasty.gif</a>; [R,L]

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} !^Mozilla* [OR]

RewriteCond %{HTTP_USER_AGENT} !^Netscape* [OR]

RewriteCond %{HTTP_USER_AGENT} !^Opera* [OR]

RewriteCond %{HTTP_USER_AGENT} !^MSIE* [OR]

RewriteCond %{HTTP_USER_AGENT} !^libwww-perl* [OR]

RewriteCond %{HTTP_USER_AGENT} !^Googlebot* [OR]

RewriteCond %{HTTP_USER_AGENT} !^Atomz* [OR]

RewriteCond %{HTTP_USER_AGENT} !^Scooter*

RewriteRule /*$ <a href="http://somesite.net/error.html"; target="_blank">http://somesite.net/error.html</a>; [L,R]



As you can see, I'm also utilizing the anti-hotlinking option. Right now, I have an htaccess that has every app that I don't want, yet it takes way too much memory to use.



Thank you so much.



Mando\\

Comments

  • Reply 1 of 10
    defiantdefiant Posts: 4,876member
    mando, how are u ? everything fine ?



    well, I don't know apache, but I looked through that list and saw that OmniWeb is missing from that list <img src="graemlins/bugeye.gif" border="0" alt="[Skeptical]" /> wassup ?





    edit: spellingh



    [ 10-26-2002: Message edited by: /mandolux/ ]



    [ 10-26-2002: Message edited by: Defiant ]</p>
  • Reply 2 of 10
    ...okay. I'll add OmniWeb. But still, nobody has helped me with this issue. I wonder why.



    P.S. I hope you're not mad at me for the money desktop ?
  • Reply 3 of 10
    defiantdefiant Posts: 4,876member
    [quote]Originally posted by /mandolux/:

    <strong>...okay. I'll add OmniWeb.</strong><hr></blockquote>



    Thank You.



    [quote]Originally posted by /mandolux/:

    <strong>But still, nobody has helped me with this issue. I wonder why.</strong><hr></blockquote>



    maybe because only 3hrs (edit: 4hrs + counting) have passed ?



    [quote]Originally posted by /mandolux/:

    <strong>P.S. I hope you're not mad at me for the money desktop ?</strong><hr></blockquote>



    mad ? me ? no... ARGHGHH!!!!!



    [ 10-26-2002: Message edited by: Defiant ]</p>
  • Reply 4 of 10
    ...hehehe.
  • Reply 5 of 10
    defiantdefiant Posts: 4,876member
    they don't want to help you, want they ?
  • Reply 6 of 10
    I guess not - maybe this is not the place for these kinds of questions. Bummer.
  • Reply 7 of 10
    123123 Posts: 278member
    [quote]Originally posted by /mandolux/:

    <strong>Hello,



    I was wondering if anyone can help me with the following: I would like to deprive access to a Apache WWW server using a new htaccess....

    Mando\\</strong><hr></blockquote>



    don't turn the rewrite engine on twice. also, (not mozilla) or (not netscape) etc. will always evaluate to true. this should work:

    [code]

    RewriteCond %{HTTP_USER_AGENT} !^Mozilla [NC]

    RewriteCond %{HTTP_USER_AGENT} !^Netscape [NC]

    RewriteCond %{HTTP_USER_AGENT} !^Opera [NC]

    RewriteCond %{HTTP_USER_AGENT} !^MSIE [NC]

    RewriteCond %{HTTP_USER_AGENT} !^libwww-perl [NC]

    RewriteCond %{HTTP_USER_AGENT} !^Googlebot [NC]

    RewriteCond %{HTTP_USER_AGENT} !^Atomz [NC]

    RewriteCond %{HTTP_USER_AGENT} !^Scooter [NC]

    RewriteRule . <a href="http://somesite.net/error.html"; target="_blank">http://somesite.net/error.html</a>; [L,R] </pre><hr></blockquote>



    However, keep in mind that this is pretty much useless because you'll upset people using exotic browsers and the UA string is easy to spoof anyway.
  • Reply 8 of 10
    Thank you so much 123.



    What Apache version did you used and in what platform?



    thanx.
  • Reply 9 of 10
    123123 Posts: 278member
    [quote]Originally posted by /mandolux/:

    <strong>Thank you so much 123.



    What Apache version did you used and in what platform?

    </strong><hr></blockquote>



    1.3.26, solaris



    Make sure mod_rewrite is installed at all. Providers often don't like it because you can create unlimited subdomains and domains without paying.
  • Reply 10 of 10
    123 - how big were the changes you saw when using the htaccess before and after? I'm using Apache/1.3.22/Red Hat on SPARC and saw my Apache memory allocation go up almost 80%. Even though I have the memory, should I be worry?



    (Maybe I'm mistaken, but a big.htaccess file can really take a lot of memory. When I was using an ht with over 50 apps, my memory usage went ballistic.)



    On last thing - have you tried Solaris 9?



    Thanx again.
Sign In or Register to comment.