[Slackdocs] Server OS upgrade this week

Didier Spaier didier at slint.fr
Wed Aug 19 22:26:33 CEST 2015


On 19/08/2015 19:58, Eric Hameleers (SBo) wrote:
 > There were some initial troubles because I had not noticed that Apache
 > 2.4 does not load mod-cgi by default. My cgi scripts were not executing
 > and their source code was displayed instead.
 > Once I realized that crucial difference with Apache 2,2, gitweb and cgit
 > started working again.
This reminds me the hard time I had making the attached file
works the same here (2.4) and on my shared hosting plan (2.2).

I am not surprised that many webmasters/host managers
be reluctant to upgrade ;)

Oh, and before I forget: thanks for taking care of
that for all of us.

Cheers,
Didier
-------------- next part --------------
# Written by Didier Spaier 2014
# Public domain
# this file is intended to be used with an Apache server, version 2.2 or 2.4.
# This .htaccess file is at the root of slint.fr website.
# Its goal is to send pages in language preferred by the user:
# * in the language chosen by clicking on an hyper link that displays a
#   two characters language code
# * else in a language found in the Accept-Language HTTP header, if a page
#   is available in that language
# * else (as a fall back) in English
# All pages are in per language subdirectories

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml

# Be kind with vistors clicking on broken links
FallbackResource /sorry_the_requested_resource_was_not_found.html

# Options that follow are mandatory for Rewrite to work in a .htaccess context
RewriteEngine On
Options  FollowSymLinks

# Make sure our relative rewriting work
RewriteBase /

# Avoid caching pages in the browser to make sure they are displayed in the
# preferred language, possibly just set or changed
ExpiresActive On
ExpiresByType text/html A1

# Set the language when user clicks on a language link, recording it in a cookie
RewriteCond %{THE_REQUEST} .*/(bs|de|el|en|es|fr|id|it|nl|pl|pt_BR|pt_PT|ru|sr|sv|tr|uk|zh_CN)/.*html
RewriteRule ([a-z]*.html) - [L,CO=lang:%1:slint.fr]

# Send localized page corresponding to language setting
RewriteCond %{REQUEST_URI} !^/slint.fr/(bs|de|el|en|es|fr|id|it|nl|pl|pt_BR|pt_PT|ru|sr|sv|tr|uk|zh_CN)/(.*$)
RewriteCond %{THE_REQUEST} .*html
RewriteCond %{HTTP_COOKIE} lang=(bs|de|el|en|es|fr|id|it|nl|pl|pt|ru|tr|uk)
# We'll skip the next rule if this one is applied, as language chosen by user
# is preferred to the one set in the Accept-Language header
RewriteRule ([a-z]*.html) %1/$1 [S=1]

# If the language is not set, but a preferred language is set and we have the
# requested page in that language, send it
RewriteCond %{REQUEST_URI} !^/slint.fr/(bs|de|el|en|es|fr|id|it|nl|pl|pt_BR|pt_PT|ru|sr|sv|tr|uk|zh_CN)/.*$
RewriteCond %{THE_REQUEST} .*html
RewriteCond %{HTTP_COOKIE} !lang=([^;]+) [NC]
# The condition pattern below is of course perfectible, to say it kindly.
# Refining it to better take in account details clause 14.4 of RFC 2616 is
# left to the reader as an exercise ;)
# I don't feel too ashamed as the user can easily set his or her preferred
# language anyway.
RewriteCond %{HTTP:Accept-Language} ^(bs|de|el|en|es|fr|id|it|nl|pl|pt_BR|pt_PT|ru|sr|sv|tr|uk|zh_CN).*$
RewriteRule ([a-z]*.html) %1/$1

# Fallback in case of wrong URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /sorry_the_requested_resource_was_not_found.html [PT]


More information about the Slackdocs mailing list