Closed bnomei closed 2 years ago
Duplicate of https://github.com/getkirby/staticache/issues/4
Hey there,
I know it's a closed topic, but I'm struggling to make it work with a public folder setup. Which is exactly the same as in your configuration bnomei/kirby3-with-public-folder-kit. So on my PLESK panel I set the website root to mywebsite.com/public
and so when I type mywebsite.com, i'm actually inside the /public
folder.
The problem is that I'm not sure how to reflect this with the .htaccess
files and my config.php
.
On my config.php I tried to following:
'cache' => [
'pages' => [
'active' => false,
'type' => 'static',
'root'=> '/storage/cache/'
],
]
My .htaccess:
RewriteCond %{DOCUMENT_ROOT}/storage/cache/%{SERVER_NAME}/pages/%{REQUEST_URI}/index.html -f [NC]
RewriteRule ^(.*) %{DOCUMENT_ROOT}/storage/cache/%{SERVER_NAME}/pages/%{REQUEST_URI}/index.html [L]
RewriteCond %{DOCUMENT_ROOT}/storage/cache/%{SERVER_NAME}/pages/%{REQUEST_URI} -f [NC]
RewriteRule ^(.*) %{DOCUMENT_ROOT}/storage/cache/%{SERVER_NAME}/pages/%{REQUEST_URI} [L]
But apparently the %{DOCUMENT_ROOT}
points to the mywebsite.com/public/
. How can I point it to the correct folder which should be: mywebsite.com/storage/cache
?
Any hint would be appreciated.
@psntr You can replace the document root placeholder with the full absolute path to the directory on your server.
@lukasbestle thank you for the fast reply. So you meant on the .htaccess
file right?
config.php:
'cache' => [
'pages' => [
'active' => true,
'type' => 'static',
]
],
I see the files are been created in the correct folder but I don't see them being used in the frontend.
.htaccess:
RewriteCond /home/httpd/vhosts/mywebsite.com/storage/cache/%{SERVER_NAME}/pages/%{REQUEST_URI}/index.html -f
RewriteRule ^(.*) /home/httpd/vhosts/mywebsite.com/storage/cache/%{SERVER_NAME}/pages/%{REQUEST_URI}/index.html [L]
RewriteCond /home/httpd/vhosts/mywebsite.com/storage/cache/%{SERVER_NAME}/pages/%{REQUEST_URI} -f
RewriteRule ^(.*) /home/httpd/vhosts/mywebsite.com/storage/cache/%{SERVER_NAME}/pages/%{REQUEST_URI} [L]
Yes.
That's odd, the html files are in the correct folder mywebsite.com/storage/cache/
with correct subfolder and so on. But in the frontend, it still the PHP file being shown?
The solution for me was to create a symlink, I saw a similar case that solved that way on the forum so I tried and it works. Full thread here: Kirby forum
Thanks for the update, I will add the insights from this thread and the forum thread to the plugin's README
.
i get that its easier to setup if its just
/static
but i think it would make sense to allow the folder to be changed. mentioning that that folder in the htaccess/nginx config needs to be adjusted as well should suffice.personally i would i use public folder setups wit CI all the time so i would like to set it to
storage/caches/static/
.