I’m trying to create my first small Kirby plugin, but I’m running into a problem loading assets on the frontend. I read (and thought I understood) the handling of plugin assets. However, it’s still not working.
The asset is located on the server at site/plugins/pluginname/assets/js/myscript.js
So the url to include in the header should be media/plugins/pluginauthor/pluginname/js/myscript.js and I included it via
<?php echo(js(['media/plugins/pluginauthor/pluginname/js/myscript.js', '@auto'])); ?>
Now when I load the page from the remote webserver, the request for the mentioned asset returns a 403 - forbidden. File permissions for this asset on the remote server are the same as as for standard (non-plugin) assets. Standard assets are being loaded correctly, plugin assets not.
When loading the page locally with the php built-in server (php -S …) the asset is loaded correctly.
So I assume it has to do with the .htaccess file which kicks in on the remote webserver. However, I’m using the default .htaccess from Kirby plainkit and the media folder is not rewritten there or anything. The only line which might be involved is this
RewriteRule ^site/(.*) index.php [L]
However, this shouldn’t have an effect on the file which is accessible by the url media/… and not site/…
Can anyone please help me out?