givanz / Vvveb

Powerful and easy to use cms to build websites, blogs or ecommerce stores.
https://www.vvveb.com
GNU Affero General Public License v3.0
241 stars 49 forks source link

Subfolder support #60

Closed Terramoto closed 6 months ago

Terramoto commented 6 months ago

Hello,

I've setup vvveb on a subfolder and attempted to rewrite the requests to the folder in question but the website interface breaks as it keeps trying to access %{DOCUMENT_ROOT}/public/*. How can i adjust the settings to accommodate the subfolder in the path?

My .htaccess looks like this:

RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP_COOKIE} !^.*(nocache).*$
#RewriteCond %{QUERY_STRING} !^.*(nocache|admin).*$
RewriteCond %{QUERY_STRING} !^.*(/test/admin).*$
RewriteCond %{DOCUMENT_ROOT}/test/public/page-cache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) /test/public/page-cache/%{HTTP_HOST}/$1/index.html [L]
RewriteCond %{DOCUMENT_ROOT}/test/public/page-cache/%{HTTP_HOST}/$1 -f
RewriteRule ^(.*) /test/public/page-cache/%{HTTP_HOST}/$1 [L]
#end page cache

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /test/index.php [L]
</IfModule>

I also believe this might be the issue experienced on #10 (maybe he meant subfolder instead of subdomain)

givanz commented 6 months ago

Hi

To install in a subfolder you need to replace

defined('V_SUBDIR_INSTALL') || define('V_SUBDIR_INSTALL', false);

with

defined('V_SUBDIR_INSTALL') || define('V_SUBDIR_INSTALL', '/mysubfolder');

in /env.php file https://github.com/givanz/Vvveb/blob/master/env.php#L47

Terramoto commented 6 months ago

Hi

To install in a subfolder you need to replace

defined('V_SUBDIR_INSTALL') || define('V_SUBDIR_INSTALL', false);

with

defined('V_SUBDIR_INSTALL') || define('V_SUBDIR_INSTALL', '/mysubfolder');

in /env.php file https://github.com/givanz/Vvveb/blob/master/env.php#L47

There's no easy way to adjust it if i move the installation folder to another location? Im guessing this is only during installation?

Thank you!

givanz commented 6 months ago

If you move to a different subfolder you only need to update the V_SUBDIR_INSTALL constant with the new subfolder and clear cache.

You don't need to make other changes or change anything in the database except update menu links in the admin.

It will work after installation also.

If you move to root and no longer use a subfolder just set it to false.