# Copyright 2016 Peter Beverloo. All rights reserved.
# Use of this source code is governed by the MIT license, a copy of which can
# be found in the LICENSE file.
RewriteEngine On
# Only allow the portals to be used from secured connections
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
# Enable PHP errors and warnings
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_value error_reporting -1
# Disallow access to .git and .gitignore entirely.
RedirectMatch 404 /.git
RedirectMatch 404 /.gitignore
# Disallow access to other files that don't have to be web-accessible.
RedirectMatch 404 /configuration/
RedirectMatch 404 /composer.json
RedirectMatch 404 /composer.lock
RedirectMatch 404 /gulpfile.js
RedirectMatch 404 /node_modules/
RedirectMatch 404 /package.json
RedirectMatch 404 /phpcs.xml
RedirectMatch 404 /phpunit.xml
# These files will be generated based on the environment and needs.
RewriteRule ^manifest.json$ /manifest.php [L]
RewriteRule ^anime.css$ /style/aggregated.php [L]
RewriteRule ^anime-legacy.js$ /scripts/aggregated.php [L]
# URLs used by the client-side application.
RewriteRule ^(events|floors|stewards)/ / [L]
# Vanity URLs for the tools hosted on these domains.
RewriteRule ^hallo$ /hallo/ [R=301]
RewriteRule ^hallo/?(.*) /tools/registration/$1 [L]
RewriteRule ^schedule$ /schedule/ [R=301]
RewriteRule ^schedule/?(.*) /tools/schedule/$1 [L]
RewriteRule ^scheduler$ /scheduler/ [R=301]
RewriteRule ^scheduler/?(.*) /tools/event-scheduling-calculator/$1 [L]