I’d like to create a redirect from:
[insertdomain].com?storeId={entityId}
To the actual page with standard URL structure:
[insertdomain].com/country/state/city/addressLine1
I’ve added ?storeid=${document.id.toString()} to the getRedirects function in the location page template (as described in URL Routing | Hitchhikers), but when I publish my change the system keeps adding a slash before it, like [insertdomain].com/?storeId={entityId}
Is there a way to make this kind of redirect work?
Have checked what you have implemented here. Since the method you are using here uses path creates by getpath, have you checked the path which has been created and received in getpath? Seems like “/” is available in the paths created.
/**
Defines a list of paths which will redirect to the path created by getPath.
NOTE: This currently has no impact on the local dev path. Redirects will be set up on
a new deploy.
*/
export const getRedirects: GetRedirects = ({ document }) => {
return [index-old/${document.locale}/${document.id.toString()}];
};
So if slug = “us/co/denver”, then the overall page url becomes [insertdomain].com/us/co/denver
This is what I have for the redirects function
export const getRedirects: GetRedirects = ({ document }) => {
return [index-old/${document.locale}/${document.id.toString()}, storeid=${document.id.toString()}];
};
I’m not intentionally adding the slash