URL Paths require all paths to resolve else resulting in a 404 page not found?

Hi all,

I have an existing site structure I would like to replicate such as:
example.com/search/laptops/accessories

Currently I show different content on the page if the URL is like this:
example.com/search
example.com/search/laptops

I have discovered that in WeWeb that for a URL to resolve when using URL paths that each path must be defined eg.
example.com/search/{{path|value1}}/{{subpath|value2}}

So using the above structure:
example.com/search - results in a 404 error
example.com/search/laptops - results in a 404 error
example.com/search/laptops/accessories - Shows page content.

Frustratingly the Editor permits you to change pages using missing URL paths, it has only been on publishing to staging that the web app causes the 404.

Is there anyway at all to stop WeWeb returning a 404 and actually displaying content when a URL path is not defined? I have conditional logic in place to manage this, it is just that the URL causes the 404.

Hi @AdamKB :wave:

Indeed this is not possible yet in WeWeb. We’re exploring the option of enabling this but for now, you would need 3 separate pages:

  • one for search
  • one for search/laptops
  • one for search/laptops/accessories

If you use multi-page sections to leverage the fact that WeWeb publishes an SPA, the user experience should still be great.

Thanks @Joyce this was very helpful.
I ended up creating 3 pages named as follows:

  • search (root) - has no page paths
  • search (path) - has 1 page path
  • search (path and subpath) - Has 2 page paths

Then added the relevant logic and multi page sections for each page. So now each URL path resolves and I can maintain my URL structure that is already indexed in Google.

2 Likes

Hi @Joyce

Just checking if this is still the best way to achieve this as you mentioned you guys are “exploring the option”?

Also, how are language paths handled in a similar situation? Do we have to setup 2 pages or will it revert to just one? E.g.