-
Notifications
You must be signed in to change notification settings - Fork 10
/
htaccess.sample
54 lines (46 loc) · 2.54 KB
/
htaccess.sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
##############################################################################
# THIS IS A SAMPLE .htaccess FILE TO LET ADA WORK IN A NON MULTIPROVIDER WAY
# IF USED IN MULTIPROVIDER MODE THERE SHOULD BE NO UNWANTED EFFECT AT ALL!
#
# If ada is not installed in an apache root dir (e.g. www.yoursite.com/yourdir)
# you must replace <YOUR_DIR_HERE> with actual directory ada is installed in
##############################################################################
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/<YOUR_DIR_HERE>/clients/client(\d*)$ [OR,NC]
RewriteCond %{REQUEST_URI} ^/<YOUR_DIR_HERE>/client(\d*)$
RewriteRule .* %{HTTP_ROOT_DIR}/<YOUR_DIR_HERE> [R=301,L]
##################################################
# adds a trailing slash if none is given.
# e.g. : http://www.localada.com/budapest becomes
# http://www.localada.com/budapest/
# this is mainly done for relative links to be
# properly handled by the browser
#################################################
RewriteCond %{REQUEST_URI} ^/<YOUR_DIR_HERE>/(\w+)$
RewriteRule ^(.*)$ %{HTTP_ROOT_DIR}/<YOUR_DIR_HERE>/$1/ [L,R=301]
#################################################
# rewrites provider url to point to clients,
# only if it does not alreay contains 'clients' string
# and what the user is asking is a subdir of clients
# and what the user is asking is not a file in standard ADA (i.e. starting from ADA root dir)
# (prevents infinte loop, without the cond it will always
# prepend /clients in every iteration and redirection of every other file)
# e.g. http://www.localada.com/budapest/view.php?id=xx&op=yy becomes
# http://www.localada.com/clients/budapest/view.php?id=xx&op=yy
#
# NOTE THAT: (from http://httpd.apache.org/docs/trunk/rewrite/remapping.html)
#
# This one uses an often-overlooked feature of mod_rewrite, by taking advantage of the order of execution of the ruleset.
# In particular, mod_rewrite evaluates the left-hand-side of the RewriteRule before it evaluates the RewriteCond directives.
# Consequently, $1 is already defined by the time the RewriteCond directives are evaluated.
#################################################
RewriteCond $1 !^clients$
RewriteCond $2 ^$
RewriteCond %{DOCUMENT_ROOT}/<YOUR_DIR_HERE>/clients/$1 -d
RewriteRule ^(\w*)/(.*) /<YOUR_DIR_HERE>/clients/$1/ [L,QSA]
RewriteCond $1 !^clients$
RewriteCond $2 !^$
RewriteCond %{DOCUMENT_ROOT}/<YOUR_DIR_HERE>/clients/$1/$2 -f
RewriteRule ^(\w*)/(.*) /<YOUR_DIR_HERE>/clients/$1/$2 [L,QSA]
RewriteCond %{DOCUMENT_ROOT}/<YOUR_DIR_HERE>/$2 -f
RewriteRule ^(\w*)/(.*) /<YOUR_DIR_HERE>/$2 [L,QSA]