comparison .htaccess @ 0:493bcb69166c

added public content
author Daniel Wolff
date Tue, 09 Feb 2016 20:54:02 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:493bcb69166c
1 <IfModule mod_authz_core.c>
2 Require all granted
3 </IfModule>
4 <IfModule !mod_authz_core.c>
5 Order allow,deny
6 Allow from all
7 </IfModule>
8
9 Options -Indexes
10 Options +FollowSymLinks
11 ErrorDocument 403 /404/
12 ErrorDocument 404 /404/
13
14 # Use the front controller as index file. It serves as a fallback solution when
15 # every other rewrite/redirect fails (e.g. in an aliased environment without
16 # mod_rewrite). Additionally, this reduces the matching process for the
17 # start page (path "/") because otherwise Apache will apply the rewriting rules
18 # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
19 DirectoryIndex a_prod.php
20
21 <IfModule mod_rewrite.c>
22 RewriteEngine On
23
24 # Determine the RewriteBase automatically and set it as environment variable.
25 # If you are using Apache aliases to do mass virtual hosting or installed the
26 # project in a subdirectory, the base path will be prepended to allow proper
27 # resolution of the a_prod.php file and to redirect to the correct URI. It will
28 # work in environments without path prefix as well, providing a safe, one-size
29 # fits all solution. But as you do not need it in this case, you can comment
30 # the following 2 lines to eliminate the overhead.
31 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
32 RewriteRule ^(.*) - [E=BASE:%1]
33
34 # Redirect to URI without front controller to prevent duplicate content
35 # (with and without `/a_prod.php`). Only do this redirect on the initial
36 # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
37 # endless redirect loop (request -> rewrite to front controller ->
38 # redirect -> request -> ...).
39 # So in case you get a "too many redirects" error or you always get redirected
40 # to the start page because your Apache does not expose the REDIRECT_STATUS
41 # environment variable, you have 2 choices:
42 # - disable this feature by commenting the following 2 lines or
43 # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
44 # following RewriteCond (best solution)
45 RewriteCond %{ENV:REDIRECT_STATUS} ^$
46 RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
47
48 # If the requested filename exists, simply serve it.
49 # We only want to let Apache serve files and not directories.
50 RewriteCond %{REQUEST_FILENAME} -f
51 RewriteRule .? - [L]
52
53 # Rewrite all other queries to the front controller.
54 RewriteRule .? %{ENV:BASE}/a_prod.php [L]
55 </IfModule>
56
57 ## App entry point
58 <IfModule !mod_rewrite.c>
59 <IfModule mod_alias.c>
60 # When mod_rewrite is not available, we instruct a temporary redirect of
61 # the start page to the front controller explicitly so that the website
62 # and the generated links can still be used.
63 RedirectMatch 302 ^/$ /a_prod.php/
64 # RedirectTemp cannot be used instead
65 </IfModule>
66 </IfModule>
67
68 ## HTTP Caching
69 <ifModule mod_headers.c>
70 <filesMatch "\.(ico|jpe?g|jpg|png|gif|swf|css|js)$">
71 Header unset Pragma
72 FileETag None
73 Header unset ETag
74 #10 years
75 Header set Cache-Control "max-age=315360000, public, must-revalidate"
76 #Header set Cache-Control "max-age=315360000, public"
77 Header unset Last-Modified
78 </filesMatch>
79 </IfModule>
80
81 ## Gzip
82 <ifmodule mod_deflate.c>
83 AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
84 </ifmodule>
85
86 ## Deny access to some files and folders
87 <FilesMatch "\.buildpath|\.hgignore|\.project|composer\..*|readme\.txt|SYMFONY-LICENSE">
88 Order allow,deny
89 Deny from all
90 </FilesMatch>
91 RedirectMatch 404 /\\.hg(/.*|$)
92 RedirectMatch 404 /\\.hgcheck(/.*|$)
93 RedirectMatch 404 /\\.settings(/.*|$)