0

We have a couple of different repos doing various things all on the same URL. All of these have a web folder equivalent and want to be above the root. With that in mind, I've set up the following directory structure:

public_html
│
└───files
│   └───craft
│   │   │   Craft stuff
│   │   │   ...
|   |   └───web
|   |
│   └───othersite
│       |   other framework
|       |   ...
|       └───web
|
└───public
    |   .htaccess

In my vhosts, I've set up aliases like so:

DocumentRoot "/var/www/public_html/public"
Alias /othersite/ "/var/www/public_html/files/othersite/web/"
Alias /craft/ "/var/www/public_html/files/craft/web/"

Then I have a htaccess file in public with the following logic

# Redirect specific URLs to the other framework
RewriteCond %{REQUEST_URI} ^/othersiteurl/?(.*)$ [NC]
RewriteRule ^othersiteurl/?(.*) /othersiteurl/index.php [QSA,L]

# Default to Craft if not already redirected
RewriteRule (.*) /craft/$1 [QSA,L]

For all the frontend code, this works perfectly, but I'm struggling with the control panel. It all works on the expected URLs, but all the nav links include craft, like domain.com/craft/admin/dashboard

I've got the cptrigger config set

    'cpTrigger' => App::env('CP_TRIGGER') ?: 'admin',

which all works as expected, other than adding the /craft/ bit into the URL.

I assumed that setting the baseCpUrl would get around this like so:

    'baseCpUrl' => App::env('SITEURL'),

But now if I go to domain.com/admin or domain.com/craft/admin I just get a 404.

I'm completely stumped. Any ideas what I'm doing wrong?

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.