SELECT


                IF(`Parent`.`URLLabel` <> '' AND `pages`.`ParentID` > 1, CONCAT('RedirectMatch 301 ^/', `Parent`.`URLLabel`, '/', `pages`.`URLLabel`, '/?$'), CONCAT('RedirectMatch 301 ^/', `pages`.`URLLabel`, '/?$')) AS `URLLabel`,
                IF(`Parent`.`URLLabel` <> '' AND `pages`.`ParentID` > 1, CONCAT('/bg/', `Parent`.`URLLabel`, '/', `pages`.`URLLabel`, '.html'), CONCAT('/bg/', `pages`.`URLLabel`, '.html')) AS `URLLabel`

            FROM
                `pages`
                LEFT JOIN `pages` AS `Parent` ON
                    `pages`.`ParentID` = `Parent`.`ID` AND
                    `pages`.`Language` = `Parent`.`Language`
            WHERE
                `pages`.`Language` = 'bg';



-----------------------------


SELECT


                IF(`Parent`.`URLLabel` <> '' AND `pages`.`ParentID` > 1, CONCAT('RedirectMatch 301 ^/en/', `Parent`.`URLLabel`, '/', `pages`.`URLLabel`, '/?$'), CONCAT('RedirectMatch 301 ^/en/', `pages`.`URLLabel`, '/?$')) AS `URLLabel`,
                IF(`Parent`.`URLLabel` <> '' AND `pages`.`ParentID` > 1, CONCAT('/en/', `Parent`.`URLLabel`, '/', `pages`.`URLLabel`, '.html'), CONCAT('/en/', `pages`.`URLLabel`, '.html')) AS `URLLabel`

            FROM
                `pages`
                LEFT JOIN `pages` AS `Parent` ON
                    `pages`.`ParentID` = `Parent`.`ID` AND
                    `pages`.`Language` = `Parent`.`Language`
            WHERE
                `pages`.`Language` = 'en';




/\s+/
/ /