Statamic V3 installation in sub-directory? #6681
Replies: 4 comments 5 replies
-
Maybe something like this? https://laravel-news.com/subfolder-install |
Beta Was this translation helpful? Give feedback.
-
Hi, There is this elegant solution https://serversforhackers.com/c/nginx-php-in-subdirectory which I tried for this scenario. After I configured nginx, because my application has the domain In order to have all the urls prefixed with Statamic documentation sais to configure your "sites" like so:
But Statamic has this routes for images manipulation with Glide:
As you can see it prefixes all the Glide routes with the If you configure your nginx to work as in the post above, you will see that Glide routes will not match anymore because your url is The issue is that if you prefix all the urls with
Because of this, the glide routes are not matched by the To make this work, maybe glide routes should not be prefixed with the I would vary much appreciate any idea regarding this. P.S. Another issue, which I believe it's a small bug into statamic code is that the hash from the image url For example if you have a
The end result because of the
But notice that this hash
Notice that in the previous Let me know if anyone else could reproduce this, I think just by replacing the Thank you! |
Beta Was this translation helpful? Give feedback.
-
@edalzell Hi - Do you have a solution for the bug mentioned above by iulyanp in the PS> section where the hash from the image url example: YXNzZXRzL29jdG9wdXMuanBn can sometimes contain = signs? |
Beta Was this translation helpful? Give feedback.
-
Subdirectory support in the way that you're describing is not really common, but I guess you could make it work.
In require __DIR__.'/../statamic/vendor/autoload.php';
...
$app = require_once __DIR__.'/../statamic/bootstrap/app.php'; In Where you put your assets is up to you, but you'll need to be aware that if there are places that would be relative to the root, it will be relative to the actual root, not /blog. That's just the way websites work. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
We are trying to setup Statamic v3 in a subdirectory /blog/ however we ran into problems configuring it to work property.
It seems statamic doesn't know that it should run under /blog and all the assets (css, image, js) should be in this subdirectory. It seems to look for assets relative to the root (but there is no asset from statamic in the root).
We had to hardcode some things and we prefixed with /blog but when we configure nginx to load statamic from a subdirectory, it doesn't know anymore where the assets are (so we had to hardcode the path to css / js files).
Also the images from the "blog homepage" are not shown because statamic has a functionality that is resizing images on the fly, but now the urls for resize images are not matching the right route from statamic to actually resize the images and display them.
We found instructions for Installing in a Subdirectory for v2: https://v2.statamic.com/knowledge-base/subdirectory-installation but nothing for v3.
Are we correct to assume that Statamic 3 is NOT built to support this kind of installation in a different directory under a "/something"?
I would very much appreciate some advice because right now we're stuck.
PS: We can't run it the root because we already have a "catch-all" route for custom pages on our site.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions