########### AMEMBER START #####################
Options +FollowSymLinks 
RewriteEngine On

# if cookie is set and file exists, stop rewriting and show page
RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
RewriteCond /home/shawonag/app.orbititltd.com/data/new-rewrite/%1-1 -f
RewriteRule ^(.*)$ - [S=3]

# if cookie is set but folder file does not exists, user has no access to given folder
RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
RewriteCond /home/shawonag/app.orbititltd.com/data/new-rewrite/%1-1 !-f
RewriteRule ^(.*)$ https://app.orbititltd.com/no-access/folder/id/1?url=%{REQUEST_URI}?%{QUERY_STRING}&host=%{HTTP_HOST}&ssl=%{HTTPS} [L,R]

## if user is not authorized, redirect to login page
# BrowserMatch "MSIE" force-no-vary
RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^(.*)$ https://app.orbititltd.com/protect/new-rewrite?f=1&url=%{REQUEST_URI}?%1&host=%{HTTP_HOST}&ssl=%{HTTPS} [L,R,B]
RewriteRule ^(.*)$ https://app.orbititltd.com/protect/new-rewrite?f=1&url=%{REQUEST_URI}&host=%{HTTP_HOST}&ssl=%{HTTPS} [L,R]
########### AMEMBER FINISH ####################

# If no specific file is requested, load default.php
RewriteCond %{REQUEST_URI} !^/default.php$
RewriteRule ^$ /default.php [L]