DocumentRoot "/var/www/localhost/htdocs"
<Directory "/var/www/localhost/htdocs">
Options FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
#RewriteLog /var/log/apache2/rewrite_log
#RewriteLogLevel 9
# set exceptions here (all webapps, aliases, services, etc)
RewriteCond %{REQUEST_URI} /manual/
RewriteRule ^(.*)$ $1 [L,PT]
# root -> index document
RewriteRule ^/$ /index/ [R,NS,L]
# keep language if coming from an explicitly-selected-lang document
RewriteCond %{HTTP_REFERER} /([a-z][a-z])$
RewriteRule ^(.*)/$ $1/%1 [R,L]
# map directory names (with or without explicit lang) to file base names
# MultiViews will do the rest
RewriteRule ^(.*?)/[a-z][a-z]$ $1/document [L]
RewriteRule ^(.*)/$ $1/document [L]
# pass the explicit lang to MultiViews
SetEnvIf Request_URI "/([a-z][a-z])$" prefer-language=$1
# map paths from the old website to this one
RewriteMap oldpaths txt:oldpaths.txt
RewriteCond ${oldpaths:%{REQUEST_URI}} ^(.+)$
RewriteRule \.html$ %1 [R=301,L,NS]