Moves via hreflang & canonical bundle
An idea to simplify the move from front-end to back-end, through a bunch of hreflang and canonical. If you don't know what that is, it says right here.
I have mostly small-page sites (often just 1 page = face) on static. When I started testing this bundle, there were a lot of unnecessary movements - copy the original index.php, customize the copy to display correctly at the right URL, maintain identical content in both files in case of edits, etc. In a word, troublesome
Eventually came up with the following scheme. Let's assume that initially in the index.php file was specified just canonical on the face:
<link rel="canonical" href="https://site.ru/" />
And I need to «migrate» to the /ru-ru/ directory.
In this case, in the same index.php I replace the original canonical with:
<link rel="alternate" hreflang="ru-KZ" href="https://site.ru/" />
<link rel="alternate" hreflang="ru-RU" href="https://site.ru/ru-ru/" />
<link rel="canonical" href="https://site.ru/ru-ru/" />
Then I make edits to .htaccess, so that when you request /ru-ru/ there was a reference to index.php:
RewriteRule ^ru-ru-ru/$ /index.php [L]
It would also be fancy to change the tag. <html> tongue pointing, on the muzzle:
<html lang="ru-KZ">
And on /ru-ru/ to make:
<html lang="ru-RU">
I use php code for this purpose:
<?php
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if ($path === '/') {
echo '<html lang="ru-KZ">';
} elseif ($path === '/ru-ru/') {
echo '<html lang="ru-RU">';
} else {
echo '<html>';
}
?>
As a result, 2 pages tied to 1 index.php file, which is convenient to make edits.