Offer the site from a /folder/

I’m running Frontity via NGINX proxy on Ubuntu server. WP is hosted in the same server.

If i work in / everything works fine.

But when put Frontity in a folder (/folder/) by setting up the .conf file as follow:

location /folder/ {
proxy_pass http://localhost:3000;
rewrite ^/folder(/.*)$ $1 break;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection ‘upgrade’;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

I get an issue while browsing the categories -> all WP category URLs show the same content (a list of all posts).

Any idea or help would be appreciated.

Uhm… what exactly are you trying to accomplish, something like this?
https://your-site.com // <-- access WP using PHP
https://your-site.com/wp-json // <-- access REST API
https://your-site.com/folder // <-- access WP using Frontity

Is the same content going to be available in the root and in folder or is different content?

1 Like

Hi,
the access at the api is available at:

https://mysite.com/folder1/wp-json

the wp site is in /folder1/ but not accessible at all.

i want the site to be accessible via Frontity at:

https://mysite.com/folder2/

I need to implement this because in the root location block i have another node.js application.

Thank you

Hi Ucan,

We’re working on that right now. Next week we will have it ready, when we merge this PR.

In your case, all you will have to do is to add the subdirectory property with the "/folder2" value for the @frontity/wp-source package, in frontity.settings.js.

it would be something like this:

module.exports = {
  packages: [
    "@frontity/mars-theme",
    "@frontity/tiny-router",
    {
      name: "@frontity/wp-source",
      active: true,
      state: {
        source: {
          api: "https://mysite.com/folder1/wp-json",
          subdirectory: "/folder2/"
        }
      }  
    }
  ]
}

If you have any questions about how the settings work in Frontity you can look at the documentation.

3 Likes

Ohh subdirectory. Where can we find other undoc’d props like subdirectory? Is there specific file/files we can reference until docs are updated? Thx

p.s. tried grep -r "subdirectory" /path/to/frontity/* - no results

Hi @pingram3541,

The code you’re searching for is still a work in progress, and so it isn’t in the main branch of the Frontity repository yet. But it’ll be very soon! We’ll notify when these changes are ready and published.

1 Like

We have decided to rename wpDirectory to just subdirectory so I have edited the relevant posts accordingly.


@Ucan we have reviewed everything and yes, you will be able to use Frontity that way once @David finishes the PR :slight_smile:

1 Like

@Ucan the PR was already merged in Frontity v1.

Could you please update using

> npm update

add the subdirectory setting and let us know if it works?

https://docs.frontity.org/api-reference-1/wordpress-source#state-source-subdirectory