Daniel@0:
Daniel@0: Require all granted
Daniel@0:
Daniel@0:
Daniel@0: Order allow,deny
Daniel@0: Allow from all
Daniel@0:
Daniel@0:
Daniel@0: Options -Indexes
Daniel@0: Options +FollowSymLinks
Daniel@0: ErrorDocument 403 /404/
Daniel@0: ErrorDocument 404 /404/
Daniel@0:
Daniel@0: # Use the front controller as index file. It serves as a fallback solution when
Daniel@0: # every other rewrite/redirect fails (e.g. in an aliased environment without
Daniel@0: # mod_rewrite). Additionally, this reduces the matching process for the
Daniel@0: # start page (path "/") because otherwise Apache will apply the rewriting rules
Daniel@0: # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
Daniel@0: DirectoryIndex a_prod.php
Daniel@0:
Daniel@0:
Daniel@0: RewriteEngine On
Daniel@0:
Daniel@0: # Determine the RewriteBase automatically and set it as environment variable.
Daniel@0: # If you are using Apache aliases to do mass virtual hosting or installed the
Daniel@0: # project in a subdirectory, the base path will be prepended to allow proper
Daniel@0: # resolution of the a_prod.php file and to redirect to the correct URI. It will
Daniel@0: # work in environments without path prefix as well, providing a safe, one-size
Daniel@0: # fits all solution. But as you do not need it in this case, you can comment
Daniel@0: # the following 2 lines to eliminate the overhead.
Daniel@0: RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
Daniel@0: RewriteRule ^(.*) - [E=BASE:%1]
Daniel@0:
Daniel@0: # Redirect to URI without front controller to prevent duplicate content
Daniel@0: # (with and without `/a_prod.php`). Only do this redirect on the initial
Daniel@0: # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
Daniel@0: # endless redirect loop (request -> rewrite to front controller ->
Daniel@0: # redirect -> request -> ...).
Daniel@0: # So in case you get a "too many redirects" error or you always get redirected
Daniel@0: # to the start page because your Apache does not expose the REDIRECT_STATUS
Daniel@0: # environment variable, you have 2 choices:
Daniel@0: # - disable this feature by commenting the following 2 lines or
Daniel@0: # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
Daniel@0: # following RewriteCond (best solution)
Daniel@0: RewriteCond %{ENV:REDIRECT_STATUS} ^$
Daniel@0: RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
Daniel@0:
Daniel@0: # If the requested filename exists, simply serve it.
Daniel@0: # We only want to let Apache serve files and not directories.
Daniel@0: RewriteCond %{REQUEST_FILENAME} -f
Daniel@0: RewriteRule .? - [L]
Daniel@0:
Daniel@0: # Rewrite all other queries to the front controller.
Daniel@0: RewriteRule .? %{ENV:BASE}/a_prod.php [L]
Daniel@0:
Daniel@0:
Daniel@0: ## App entry point
Daniel@0:
Daniel@0:
Daniel@0: # When mod_rewrite is not available, we instruct a temporary redirect of
Daniel@0: # the start page to the front controller explicitly so that the website
Daniel@0: # and the generated links can still be used.
Daniel@0: RedirectMatch 302 ^/$ /a_prod.php/
Daniel@0: # RedirectTemp cannot be used instead
Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0: ## HTTP Caching
Daniel@0:
Daniel@0:
Daniel@0: Header unset Pragma
Daniel@0: FileETag None
Daniel@0: Header unset ETag
Daniel@0: #10 years
Daniel@0: Header set Cache-Control "max-age=315360000, public, must-revalidate"
Daniel@0: #Header set Cache-Control "max-age=315360000, public"
Daniel@0: Header unset Last-Modified
Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0: ## Gzip
Daniel@0:
Daniel@0: AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
Daniel@0:
Daniel@0:
Daniel@0: ## Deny access to some files and folders
Daniel@0:
Daniel@0: Order allow,deny
Daniel@0: Deny from all
Daniel@0:
Daniel@0: RedirectMatch 404 /\\.hg(/.*|$)
Daniel@0: RedirectMatch 404 /\\.hgcheck(/.*|$)
Daniel@0: RedirectMatch 404 /\\.settings(/.*|$)