I have two questions with my Joomla! Project:
I would be very happy if someone can help me. Big thanks in advance and have a nice day,
Magnus
Technical Specs:
Okay, i found a solution myself. I post the code below so if someone is searching for something like this he can have a look at it.
For the start redirect:
<?php
$currentLink = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if ($currentLink == "https://example.com") {
header("Location: https://example.com/cool-submenu");
}
if ($currentLink == "https://example.com/") {
header("Location: https://example.com/cool-submenu");
}
?>
For the language redirect:
<?php
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$path = parse_url($url, PHP_URL_PATH);
$pathFragments = explode('/', $path);
$end = end($pathFragments);
if ($lang == "de") {
header("Location: https://example.com/de/{$end}");
}
?>
I hope this helps if someone needs it.
Greets, Magnus