Hello teachers,
How to set URL Prefix on the document root when create routers
I want to create routers on my Premium site.
The Help Center of Wix sais,
Premium site: https://domain . com/prefix/category/item
for setting URL Prefix, but I want to create routers on the document root:
“https://www,mydomain,com/”
How I set the “URL Prefix” above URL ?
Please tell me.
Thank you
Hi there …
I wanted to have a router on the root level as well, but that’s not how Wix works, in order for the server to determine whether this URL should run a router code or not, and what code to run exactly, each router needs a prefix, explaining the structure of the routers will help you understand why.
A router with a prefix of “members” on “www.domain.com” will have two functions on a backend file called " routers.js ", which will be as follows:
export function members_Router(request) {
// Your routing code runs here ..
}
export function members_SiteMap(request) {
// Here you should return an array of the pages that lives in this router;
return [{
title: "<Your page title>",
pageName: "<Your router page name">,
url: "https://domain.com/members/<your page path>"
}]
}
So the prefix is used to determine what code to run to build your router’s sitemap as well as hosting your router’s code logic.
Hope this helps~!
Ahmad
Dear Ahmad.
Thank you for your guide.
I understood how the router process on a backend.
I try another way to solve my problem 
Thank you again !
@takegaki No worries, glad to help.