Nextcloud and the PicoCMS app

virtualhosts
nextcloud
v7

(Don Robertson) #1

Hi - Nextcloud has an app that installs a PicoCMS content management system. To work correctly, a url needs to be rewritten. Suppose you create a PicoCMS site called ‘test’. it should be available at sub.domain.name/nextcloud/sites/picosite. The ‘real’ location is sub.domain.name/nextcloud/index.php/apps/cms_pico/pico/picosite.

I spent a lot of time mucking around with the .htaccess file trying to add a rewrite rule to get it to work. Alas without success.

To get it going I added a template to

/etc/e-smith/templates-custom/httpd/vhost-extra/

called 25modrewrite

containing

{
$OUT .= "        RewriteRule /sites/(.*) https://sub.domain.name/index.php/apps/cms_pico/pico/\$1 [QSA,L]" if ($VhostName eq 'sub');
}

where sub is the name of the vhost I have installed Nextcloud on.

Then, as root, run

expand-template /etc/httpd/conf.d/virtualhosts.conf
/bin/systemctl restart httpd.service

This adds the rewrite rule to the virtualhosts.conf file after the contents of the /etc/e-smith/templates/httpd/vhost-extra/20forcessl_redirect, which I assume is on. If not, you will need to add a line for RewriteEngine On

It is working for me at the moment with a test site. I have removed the Nethserver Nextcloud module and installed Nextcloud into a vhost manually. Wound up messing my nextcloud up by manually updating, then the nethserver updater wouldn’t work - so just installed manually. Can the update mechanism in Nextcloud be disabled?

So results may vary :slight_smile:

Or someone smart may be able to work out what would go into the .htaccess file … which would be a lot easier.

Cheer


(Markus Neuberger) #2

I found this: