How to enable Multiviews

MultiViews is an Apache per-directory option, which is not naively supported by LiteSpeed web server at the time of this writing. However it can be achieved through rewrite rule.

For example:

Options +MultiViews
AddLanguage de .de
AddLanguage en .en

can be done through the following rewrite rule:

AddType text/html .en
AddType text/html .de

SetEnvIf Accept-Language ^de LANG=.de
SetEnvIf Accept-Language ^en LANG=.en
SetEnvIf LANG ^$ LANG=.de

RewriteEngine on
RewriteCond %{REQUEST_URI} !%{ENV:LANG}$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ $1%{ENV:LANG} [L,QSA]
 
litespeed_wiki/config/multiviews.txt · Last modified: 2015/07/24 15:43 by Michael Alegre