可能なすべての翻訳 (catalog-katalog、view-something など) のリストを .htaccess ファイルに含めたくない場合は、ルーティングを処理する別の php スクリプトを作成する方が簡単です。例えば:
RewriteRule ^(en|de)/([^/]+)/(.+)\.html$ router.php?lang=$1§ion=$2&id=$3 [L,QSA]
たとえば、router.php は次のようになります。
<?php
// List of translations
$german = array(
'katalog' => 'catalog',
'something' => 'view',
...
);
// List of available sections
$allowed = array('catalog', 'view');
$section = $_GET['section'];
if ($_GET['lang'] === 'de') {
$section = isset($german[$section])? $german[$section] : NULL;
}
// IMPORTANT: Include PHP file only if section param is listed in $allowed!
// Otherwise attacker could execute any file on the server
// by opening /router.php?section=badfile
if (in_array($section, $allowed)) {
include dirname(__FILE__) . "/$section.php";
} else {
header('HTTP/1.x 404 Not Found');
print "Page not found";
}