Problem
I have a problem on a local Valet setup: the locale URL segment is appearing twice in URLs.
Eg from a page at URL of en/about/approach
, {{ url('about/approach')}}
outputs https://website.test/en/en/about/approach
(And you only get the correct URL if outputting this from /about/approach
)
Guessing I've missed something obvious but no idea what... thanks!
Setup
Base URLs are set to @web/en/
and @web/de/
.
In the web
folder we have two index files, eg de/index.php
and en/index.php
Running valet which
reports This site is served by [CraftValetDriver].
In general.php
I've got:
'test' => [
// Base site URL
'siteUrl' => 'http://website.test'
The Entry URI Format for the Pages section is {parent.slug}/{slug}
Contents of /web/en/index.php:
<?php
/**
* Craft www bootstrap file
*/
// Set path constants
define('CRAFT_BASE_PATH', dirname(__DIR__, 2));
define('CRAFT_SITE', 'english');
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');
$root = dirname(__DIR__).'/en';
// Load Composer's autoloader
require_once CRAFT_VENDOR_PATH.'/autoload.php';
// Load dotenv?
if (file_exists(CRAFT_BASE_PATH.'/.env')) {
(new Dotenv\Dotenv(CRAFT_BASE_PATH))->load();
}
// Load and run Craft
define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');
$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';
$app->run();
Contents of /web/index.php:
<?php
/**
* Craft web bootstrap file
*/
// Set path constants
define('CRAFT_BASE_PATH', dirname(__DIR__));
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');
// Load Composer's autoloader
require_once CRAFT_VENDOR_PATH.'/autoload.php';
// Load dotenv?
if (file_exists(CRAFT_BASE_PATH.'/.env')) {
(new Dotenv\Dotenv(CRAFT_BASE_PATH))->load();
}
// Load and run Craft
define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');
$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php';
$app->run();