Skip to content

Instantly share code, notes, and snippets.

@demoive
Created May 8, 2013 05:35
Show Gist options
  • Save demoive/5538457 to your computer and use it in GitHub Desktop.
Save demoive/5538457 to your computer and use it in GitHub Desktop.
SSi18n configuration files Used for the seed: For the https://github.com/demoive/SSi18n
### General settings
#####################################
DirectoryIndex index.inc
Options +FollowSymlinks
Options -Indexes
### Enable GZIP compression
#####################################
AddOutputFilterByType DEFLATE application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/html text/plain text/x-component text/xml
### Maintenance page (temporary redirect)
#####################################
#RewriteCond %{REMOTE_ADDR} !^11\.111\.111\.111
#RewriteCond %{REQUEST_URI} !^/maintenance\.html$ [NC]
#RewriteRule ^(.*)$ http://domain.com/maintenance.html [R=307,L]
### Enable Server-Side Includes (SSI)
### http://en.wikipedia.org/wiki/Server_Side_Includes
### http://httpd.apache.org/docs/current/mod/mod_include.html
#####################################
#Options -Includes
#Options -ExecCGI
Options +IncludesNOEXEC
AddOutputFilter INCLUDES .inc .html
#XBitHack on
#SSIStartTag "{{# "
#SSIEndTag " #}}"
SSIErrorMsg "<!-- SSiS Error. Contact: [email protected] -->"
SSITimeFormat "%d/%m/%y"
SSIUndefinedEcho "<!-- SSiS variable undefined -->"
### Routing
### http://httpd.apache.org/docs/current/mod/mod_rewrite.html
### http://httpd.apache.org/docs/current/rewrite/flags.html
#####################################
RewriteEngine On
RewriteBase /
# if URI is directly to our router, redirect to root (preserve query string)
#RewriteRule ^index\.inc$ / [R=301,L,QSA]
### URL formatting
#####################################
# http://stackoverflow.com/questions/6059920/removing-index-html-from-url-and-adding-www-with-one-single-301-redirect/6062534
# performs the same as the next two but in just one redirect
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
#RewriteRule . http://www.%{HTTP_HOST}%1 [R=301,NE,L]
# adds the www. in the url
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule . http://www.%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
# removes any index.php from the path, leaving just the root
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
RewriteRule . %1 [R=301,NE,L]
#adjust the above to be ..... (?:html?|php)$ (didn't do it already just so that it can be tested first)... not sure if the non-capture group works
# only point the following to our router:
# - files that don't exist
# - directories that don't exist
# - any file that ends with .inc (TODO)
# - anything inside the /partials/ or /includes/ directories (STILL NOT WORKING FULLY: a file inside /partials will still be shown)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_URI} ^/partials [OR]
RewriteCond %{REQUEST_URI} ^/includes
RewriteRule ^(.*)$ /index.inc [L,PT,NS,QSA]
# TODO - make sure there's a trailing slash on directories
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_URI} !(.*)/$
#RewriteRule ^(.*)$ %{REQUEST_URI}/ [R=301]
# for complex conditions...
#RewriteCond a [or]
#RewriteCond b
#RewriteRule . - [E=FIRSTPART:true]
#RewriteCond c [or]
#RewriteCond d
#RewriteRule . - [E=SECONDPART:true]
#RewriteCond %{ENV:FIRSTPART} true
#RewriteCond %{ENV:SECONDPART} true
#RewriteRule ...something
### Setup error documents
#####################################
#ErrorDocument 404 /test/errordocument/404.html
#Redirect 404 /test/trigger-error/404
### Setup useful environment variables
#####################################
#RewriteRule .* - [NE,E=SSIS_LOCATION_PROTOCOL:%{REQUEST_SCHEME}] #not working
#RewriteRule .* - [NE,E=SSIS_LOCATION_HOSTNAME:%{HTTP_HOST}] #includes the port
#RewriteRule .* - [NE,E=SSIS_LOCATION_PORT:%{SERVER_PORT}] #works
#RewriteRule .* - [NE,E=SSIS_LOCATION_PATHNAME:%{REDIRECT_URL}] #not working
#RewriteRule .* - [NE,E=SSIS_LOCATION_SEARCH:?%{QUERY_STRING}] #works, but each of the following encode the URI: ${QUERY_STRING}, ${REDIRECT_QUERY_STRING} or ${QUERY_STRING_UNESCAPED}
#RewriteRule \#(.*)$ - [NE,E=SSIS_LOCATION_HASH:%1] #not working
<!--
_____/\\\\\\\\\\\_______/\\\\\\\\\\\______________/\\\_____/\\\\\\\\\_____________________
____/\\\/////////\\\___/\\\/////////\\\________/\\\\\\\___/\\\///////\\\___________________
____\//\\\______\///___\//\\\______\///___/\\\_\/////\\\__\/\\\_____\/\\\___________________
______\////\\\___________\////\\\_________\///______\/\\\__\///\\\\\\\\\/____/\\/\\\\\\______
__________\////\\\___________\////\\\_______/\\\_____\/\\\___/\\\///////\\\__\/\\\////\\\_____
______________\////\\\___________\////\\\___\/\\\_____\/\\\__/\\\______\//\\\_\/\\\__\//\\\____
________/\\\______\//\\\___/\\\______\//\\\__\/\\\_____\/\\\_\//\\\______/\\\__\/\\\___\/\\\____
________\///\\\\\\\\\\\/___\///\\\\\\\\\\\/___\/\\\_____\/\\\__\///\\\\\\\\\/___\/\\\___\/\\\____
___________\///////////_______\///////////_____\///______\///_____\/////////_____\///____\///_____
https://github.com/demoive/SSi18n
-->
<!--
TODO:
- Get 404/500 working properly (and manageable)
- Define routes
- Consider using custom SSI start and end tags
- Go through .htaccess and make sure they work on a server
- http://httpd.apache.org/docs/current/mod/mod_rewrite.html
- http://httpd.apache.org/docs/current/rewrite/intro.html
-->
<!--#set var="ssis.debug" value="true" -->
<!--#set var="ssis.debug" value="silent" -->
<!--#config sizefmt="abbrev" -->
<!--#set var="ssis.lang.default" value="en" -->
<!--#if expr="$REQUEST_URI == /^(?:\/([a-z]{2}))?(\/.*?)?([?].*?)?$/" -->
<!--#set var="ssis.lang" value="$1" -->
<!--#set var="ssis.route" value="$2" -->
<!--#set var="ssis.query" value="$3" -->
<!--#endif -->
<!--#if expr="${ssis.lang} == ''" -->
<!--#set var="ssis.lang" value="${ssis.lang.default}" -->
<!--#endif -->
<!--#include virtual="/includes/routes.inc" -->
<!--#include virtual="/includes/i18n.inc" -->
<!-- Setup complete. Bootstrap the template -->
<!--#if expr="${ssis.route.code} == ''" -->
<!--#include virtual="/includes/404_html.inc" -->
<!--#else -->
<!--#include virtual="/includes/200_html.inc" -->
<!--#endif -->
<!--#if expr="${ssis.debug} == 'true'" -->
<!--#printenv -->
<!--#elif expr="${ssis.debug} == 'silent'" -->
<!--
<!--#printenv -->
-->
<!--#endif -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment