aboutsummaryrefslogtreecommitdiffhomepage
path: root/web
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-28 17:09:27 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-28 17:09:27 +0100
commite4788de51ecbf2773a043325965e10eb74b14e8f (patch)
treeca66ba084b27050ee336b93b82fbd55ac7f9fd3a /web
parent569f8d6851ea31b594fc5ccbcc11fe79dbdf2fa6 (diff)
downloadwallabag-e4788de51ecbf2773a043325965e10eb74b14e8f.tar.gz
wallabag-e4788de51ecbf2773a043325965e10eb74b14e8f.tar.zst
wallabag-e4788de51ecbf2773a043325965e10eb74b14e8f.zip
1st implementation of wallabag api, yeah
Diffstat (limited to 'web')
-rw-r--r--web/.htaccess56
1 files changed, 56 insertions, 0 deletions
diff --git a/web/.htaccess b/web/.htaccess
new file mode 100644
index 00000000..b52e3ae6
--- /dev/null
+++ b/web/.htaccess
@@ -0,0 +1,56 @@
1# Use the front controller as index file. It serves as a fallback solution when
2# every other rewrite/redirect fails (e.g. in an aliased environment without
3# mod_rewrite). Additionally, this reduces the matching process for the
4# start page (path "/") because otherwise Apache will apply the rewriting rules
5# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
6DirectoryIndex app.php
7
8<IfModule mod_rewrite.c>
9 RewriteEngine On
10
11 # Determine the RewriteBase automatically and set it as environment variable.
12 # If you are using Apache aliases to do mass virtual hosting or installed the
13 # project in a subdirectory, the base path will be prepended to allow proper
14 # resolution of the app.php file and to redirect to the correct URI. It will
15 # work in environments without path prefix as well, providing a safe, one-size
16 # fits all solution. But as you do not need it in this case, you can comment
17 # the following 2 lines to eliminate the overhead.
18 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
19 RewriteRule ^(.*) - [E=BASE:%1]
20
21 # Sets the HTTP_AUTHORIZATION header removed by apache
22 RewriteCond %{HTTP:Authorization} .
23 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
24
25 # Redirect to URI without front controller to prevent duplicate content
26 # (with and without `/app.php`). Only do this redirect on the initial
27 # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
28 # endless redirect loop (request -> rewrite to front controller ->
29 # redirect -> request -> ...).
30 # So in case you get a "too many redirects" error or you always get redirected
31 # to the start page because your Apache does not expose the REDIRECT_STATUS
32 # environment variable, you have 2 choices:
33 # - disable this feature by commenting the following 2 lines or
34 # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
35 # following RewriteCond (best solution)
36 RewriteCond %{ENV:REDIRECT_STATUS} ^$
37 RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
38
39 # If the requested filename exists, simply serve it.
40 # We only want to let Apache serve files and not directories.
41 RewriteCond %{REQUEST_FILENAME} -f
42 RewriteRule .? - [L]
43
44 # Rewrite all other queries to the front controller.
45 RewriteRule .? %{ENV:BASE}/app.php [L]
46</IfModule>
47
48<IfModule !mod_rewrite.c>
49 <IfModule mod_alias.c>
50 # When mod_rewrite is not available, we instruct a temporary redirect of
51 # the start page to the front controller explicitly so that the website
52 # and the generated links can still be used.
53 RedirectMatch 302 ^/$ /app.php/
54 # RedirectTemp cannot be used instead
55 </IfModule>
56</IfModule>