ScriptAlias /foswiki-1.1.2/bin "/var/www/html/foswiki-1.1.2/bin"
Alias /foswiki-1.1.2/pub "/var/www/html/foswiki-1.1.2/pub"

RewriteEngine    on
Alias /foswiki-1.1.2 "/var/www/html/foswiki-1.1.2"
RewriteCond %{IS_SUBREQ} ^true$ [OR]
RewriteCond %{REQUEST_URI} ^/robots.txt$
RewriteRule .* - [L]
RewriteCond  %{REQUEST_URI} ^/+foswiki-1.1.2/pub/[^/]+\.(gif|jpe?g|ico)$  [NC,OR]
RewriteCond  %{REQUEST_URI} ^/+foswiki-1.1.2/pub/System/(.*)$  [OR]
RewriteCond  %{REQUEST_URI} ^/+foswiki-1.1.2/pub/([^/]+/)+WebPreferences/([^/]+)$
RewriteRule  ^/+foswiki-1.1.2/pub/.* - [L,PT]
RewriteRule ^/+foswiki-1.1.2/+pub/+(.*)$  /foswiki-1.1.2/bin/viewfile/$1 [L,PT]
SetEnvIf Request_URI "/foswiki-1.1.2/pub/.*\.[hH][tT][mM][lL]?$" blockAccess
SetEnvIf Request_URI "/foswiki-1.1.2/pub/System/.*\.[hH][tT][mM][lL]?$" !blockAccess

<Directory "/var/www/html/foswiki-1.1.2">
    Order Allow,Deny
    Allow from all
    Deny from env=blockAccess
</Directory>

<Directory "/var/www/html/foswiki-1.1.2/bin">
    AllowOverride None
    Order Allow,Deny
    Allow from all
    Deny from env=blockAccess
    Options +ExecCGI  +FollowSymLinks
    SetHandler cgi-script
    AuthType Basic

    AuthName "Say your ldap passorwd:"
    AuthzLDAPMethod ldap
    AuthzLDAPServer "myldapserver.mydomain.com:389"
    AuthzLDAPBindDN "CN=myldapbinduser,DC=mydomain,DC=com"
    AuthzLDAPBindPassword "myldappassword"
    AuthzLDAPUserKey sAMAccountName
    AuthzLDAPUserBase "DC=com"
    AuthzLDAPUserScope subtree
    require valid-user
    AuthzLDAPLogLevel error

    ErrorDocument 401 /foswiki-1.1.2/bin/view/System/UserRegistration

    <FilesMatch "^(configure)$">
        SetHandler cgi-script
        Order Deny,Allow
        Deny from all 
        Allow from 192.168.0.1
        Satisfy All
        ErrorDocument 401 default
    </FilesMatch>

</Directory>

<Directory "/var/www/html/foswiki-1.1.2/pub">
    Options None
    Options FollowSymLinks
    AllowOverride None
    Order Allow,Deny
    Allow from all
    Deny from env=blockAccess
    ErrorDocument 404 /foswiki-1.1.2/bin/viewfile
    AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
</Directory>

<Directory "/var/www/html/foswiki-1.1.2/pub/Trash">
	deny from all
</Directory>

<Directory "/var/www/html/foswiki-1.1.2/data">
    deny from all
</Directory>

<Directory "/var/www/html/foswiki-1.1.2/templates">
    deny from all
</Directory>

<Directory "/var/www/html/foswiki-1.1.2/lib">
    deny from all
</Directory>

<Directory "/var/www/html/foswiki-1.1.2/locale">
    deny from all
</Directory>

<Directory "/var/www/html/foswiki-1.1.2/tools">
    deny from all
</Directory>

<Directory "/var/www/html/foswiki-1.1.2/working">
    deny from all
</Directory>

BrowserMatchNoCase ^Accoona blockAccess
BrowserMatchNoCase ^ActiveAgent blockAccess
BrowserMatchNoCase ^Attache blockAccess
BrowserMatchNoCase BecomeBot blockAccess
BrowserMatchNoCase ^bot blockAccess
BrowserMatchNoCase Charlotte/ blockAccess
BrowserMatchNoCase ^ConveraCrawler blockAccess
BrowserMatchNoCase ^CrownPeak-HttpAgent blockAccess
BrowserMatchNoCase ^EmailCollector blockAccess
BrowserMatchNoCase ^EmailSiphon blockAccess
BrowserMatchNoCase ^e-SocietyRobot blockAccess
BrowserMatchNoCase ^Exabot blockAccess
BrowserMatchNoCase ^FAST blockAccess
BrowserMatchNoCase ^FDM blockAccess
BrowserMatchNoCase ^GetRight/6.0a blockAccess
BrowserMatchNoCase ^GetWebPics blockAccess
BrowserMatchNoCase ^Gigabot blockAccess
BrowserMatchNoCase ^gonzo1 blockAccess
BrowserMatchNoCase ^Google\sSpider blockAccess
BrowserMatchNoCase ^ichiro blockAccess
BrowserMatchNoCase ^ie_crawler blockAccess
BrowserMatchNoCase ^iGetter blockAccess
BrowserMatchNoCase ^IRLbot blockAccess
BrowserMatchNoCase Jakarta blockAccess
BrowserMatchNoCase ^Java blockAccess
BrowserMatchNoCase ^KrakSpider blockAccess
BrowserMatchNoCase ^larbin blockAccess
BrowserMatchNoCase ^LeechGet blockAccess
BrowserMatchNoCase ^LinkWalker blockAccess
BrowserMatchNoCase ^Lsearch blockAccess
BrowserMatchNoCase ^Microsoft blockAccess
BrowserMatchNoCase ^MJ12bot blockAccess
BrowserMatchNoCase MSIECrawler blockAccess
BrowserMatchNoCase ^MSRBOT blockAccess
BrowserMatchNoCase ^noxtrumbot blockAccess
BrowserMatchNoCase ^NutchCVS blockAccess
BrowserMatchNoCase ^RealDownload blockAccess
BrowserMatchNoCase ^Rome blockAccess
BrowserMatchNoCase ^Roverbot blockAccess
BrowserMatchNoCase ^schibstedsokbot blockAccess
BrowserMatchNoCase ^Seekbot blockAccess
BrowserMatchNoCase ^SiteSnagger blockAccess
BrowserMatchNoCase ^SiteSucker blockAccess
BrowserMatchNoCase ^Snapbot blockAccess
BrowserMatchNoCase ^sogou blockAccess
BrowserMatchNoCase ^SpiderKU blockAccess
BrowserMatchNoCase ^SpiderMan blockAccess
BrowserMatchNoCase ^Squid blockAccess
BrowserMatchNoCase ^Teleport blockAccess
BrowserMatchNoCase ^User-Agent\: blockAccess
BrowserMatchNoCase VoilaBot blockAccess
BrowserMatchNoCase ^voyager blockAccess
BrowserMatchNoCase ^w3search blockAccess
BrowserMatchNoCase ^Web\sDownloader blockAccess
BrowserMatchNoCase ^WebCopier blockAccess
BrowserMatchNoCase ^WebDevil blockAccess
BrowserMatchNoCase ^WebSec blockAccess
BrowserMatchNoCase ^WebVac blockAccess
BrowserMatchNoCase ^Webwhacker blockAccess
BrowserMatchNoCase ^Webzip blockAccess
BrowserMatchNoCase ^Wells blockAccess
BrowserMatchNoCase ^WhoWhere blockAccess
BrowserMatchNoCase www\.netforex\.org blockAccess
BrowserMatchNoCase ^WX_mail blockAccess
BrowserMatchNoCase ^yacybot blockAccess
BrowserMatchNoCase ^ZIBB blockAccess

BrowserMatch "^gsa-crawler" NO_FOSWIKI_SESSION
BrowserMatchNoCase ^$ blockAccess
