So, I am making a website and I am putting it together with includes in index.php file. The problem is that website opens and shows first page perfectly, but none of the languages links work! Here is my code:
Index file:
<?php
$languages = array("eng","lat");
$sections = array("home");
$sectionTitles = array("eng" =>array(
"WHERE CAN YOU FIND US?",
"WHO ARE WE?",
"CONTACTS",
),
"lat"=>array(
"KUR MŪS ATRAST?",
"PAR MUMS",
"KONTAKTI",
));
$lang = "lat";
$section = "home";
$content = explode("/", $_SERVER['REQUEST_URI']);
if (!empty($content[1]) && (in_array($content[1], $languages))) { $lang = $content[1];}
if (!empty($content[2]) && (in_array($content[2], $sections))) { $section = $content[2];}
$sectionTitles = $sectionTitles[$lang];
include ("header.php");
include ("$lang/$section.php");
include ("footer.php");
?>
.htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(php|css|js|gif|png|jpe?g|pdf|eot|svg|ttf|woff|ico)$
RewriteRule (.*)$ /index.php [L]
link in my header file:
<a href="/eng/<?=$section?>">eng</a>
Thank you in advance!