I just installed a new Radicle project with composer, and setup my local environment. I’m running the site via Valet. Other Bedrock sites configured in the same way work fine, although they of course use /web as webroot and not /public.
I made one that I intend to try but have been testing Radicle with lando instead of valet, so this is still untested . I used the SampleValetDriver that ships with Valet and a modified version danielroe/trellis-valet-driver to make a custom driver. Maybe this will work for you or at least give you some ideas as you troubleshoot:
// ~/.config/valet/Drivers/RadicleValetDriver.php
<?php
namespace Valet\Drivers\Custom;
use Valet\Drivers\ValetDriver;
class RadicleValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return bool
*/
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return file_exists($sitePath . '/public/content/mu-plugins/bedrock-autoloader.php') &&
file_exists($sitePath . '/public/wp-config.php') &&
file_exists($sitePath . '/bedrock/application.php');
}
/**
* Determine if the incoming request is for a static file.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return string|false
*/
public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: string|false */
{
$staticFilePath = $sitePath . '/public' . $uri;
if ($this->isActualFile($staticFilePath)) {
return $staticFilePath;
}
return false;
}
/**
* Get the fully resolved path to the application's front controller.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return string
*/
public function frontControllerPath(string $sitePath, string $siteName, string $uri): string
{
$_SERVER['PHP_SELF'] = $uri;
if (strpos($uri, '/wp/') === 0) {
return is_dir($sitePath . '/public' . $uri)
? $sitePath . '/public' . $this->forceTrailingSlash($uri) . '/index.php'
: $sitePath . '/public' . $uri;
}
return $sitePath . '/public/index.php';
}
/**
* Redirect to uri with trailing slash.
*
* @param string $uri
* @return string
*/
private function forceTrailingSlash(string $uri)
{
if (substr($uri, -1 * strlen('/wp/wp-admin')) == '/wp/wp-admin') {
header('Location: ' . $uri . '/');
die;
}
return $uri;
}
}
@csorrentino I just came to the exact same conclusion, and almost the exact some code, and was ready to post the solution here. No nee, because you already posted the the solution. You were to fast! Thanks for the help.