87 lines
		
	
	
	
		
			3 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			87 lines
		
	
	
	
		
			3 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
<VirtualHost *:80>
 | 
						|
	ServerName app.sixfold.org
 | 
						|
	RedirectPermanent	/ https://app.sixfold.org/
 | 
						|
</VirtualHost>
 | 
						|
<VirtualHost *:443>
 | 
						|
	ServerName app.sixfold.org
 | 
						|
 | 
						|
	ServerAdmin sixfold@sixfold.org
 | 
						|
	DocumentRoot /srv/app.sixfold.org/www
 | 
						|
 | 
						|
	ErrorLog ${APACHE_LOG_DIR}/app.sixfold.org-error.log
 | 
						|
	CustomLog ${APACHE_LOG_DIR}/app.sixfold.org-access.log combined
 | 
						|
 | 
						|
	ErrorDocument 404 /errors/404
 | 
						|
	ErrorDocument 503 /errors/503
 | 
						|
 | 
						|
	<Directory "/srv/app.sixfold.org/www/">
 | 
						|
		# Disable .htaccess files
 | 
						|
		AllowOverride	none
 | 
						|
 | 
						|
		# Disable unneeded options
 | 
						|
		Options		none
 | 
						|
 | 
						|
		# Allow access to www/
 | 
						|
		Require		all granted
 | 
						|
	</Directory>
 | 
						|
 | 
						|
	RewriteEngine On
 | 
						|
 | 
						|
	<Files "errors/([0-9]+).php">
 | 
						|
		RewriteCond %{ENV:REDIRECT_STATUS} =""
 | 
						|
		RewriteRule .* - [R=404,L]
 | 
						|
	</Files>
 | 
						|
 | 
						|
	# Received: /filename.php and /filename.php exists in filesystem; Result: 301 redirect to /filename and restart request
 | 
						|
	RewriteCond %{REQUEST_FILENAME} \.php$
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} -f
 | 
						|
	RewriteRule ^/(.+)\.php$	/$1 [R=301,L]
 | 
						|
 | 
						|
	# Received: /filename and /filename.php exists in filesystem; Result: change /filename to /filename.php and continue processing
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.php -f
 | 
						|
	RewriteRule ^(.+)$							$1.php [QSA]
 | 
						|
 | 
						|
	# Received: /filename and /filename.xml exists in filesystem; Result: rewrite to /filename.xml
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.xml -f
 | 
						|
	RewriteRule (.*) $1.xml
 | 
						|
 | 
						|
	# Received: /filename and /filename.xhtml exists in filesystem; Result: rewrite to /filename.xhtml
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.xhtml -f
 | 
						|
	RewriteRule (.*) $1.xhtml
 | 
						|
 | 
						|
	# Redirect index pages
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index.php -f
 | 
						|
	RewriteRule (.*)	$1/index.php
 | 
						|
 | 
						|
        # Remove trailing slashes
 | 
						|
        RewriteRule                             ^/(.+?)/$                                       /$1 [R=301,L]
 | 
						|
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
 | 
						|
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index.xml -f
 | 
						|
	RewriteRule (.*)	$1/index.xml
 | 
						|
 | 
						|
	RewriteCond %{QUERY_STRING} hash=([a-z0-9]+) [NC]
 | 
						|
	RewriteRule ^/docs /docs/%1? [L,R=301]
 | 
						|
 | 
						|
	# Sixfold rewrites
 | 
						|
	RewriteRule ^/games/([0-9]+)$ /games/game.php?game=$1
 | 
						|
	RewriteRule ^/games/([0-9]+)/feedback$ /games/feedback.php?game=$1
 | 
						|
	RewriteRule ^/games/([0-9]+)/results$ /games/results.php?game=$1
 | 
						|
	RewriteRule ^/games/([0-9]+)/submit$ /games/submit.php?game=$1
 | 
						|
	RewriteRule ^/games/([0-9]+)/update$ /games/update.php?game=$1
 | 
						|
 | 
						|
	RewriteRule ^/doc/([a-z0-9]+)$ /docs/$1 [L,R=301]
 | 
						|
	RewriteRule ^/docs/([a-z0-9]+)$ /docs/index.php?hash=$1 [L,QSA]
 | 
						|
	RewriteRule ^/members/([^\.]+?)$ /members/member.php?handle=$1 [L]
 | 
						|
 | 
						|
	# PayPal order processing rewrites
 | 
						|
	RewriteRule /api/orders$ /games/process-order.php
 | 
						|
	RewriteRule /api/orders/(.*)/capture$ /games/process-order.php
 | 
						|
 | 
						|
	SSLCertificateFile /etc/letsencrypt/live/app.sixfold.org/fullchain.pem
 | 
						|
	SSLCertificateKeyFile /etc/letsencrypt/live/app.sixfold.org/privkey.pem
 | 
						|
	Include /etc/letsencrypt/options-ssl-apache.conf
 | 
						|
</VirtualHost>
 |