Wix Experts how can I Redirect on 403 ?

Hi Mauro Vento Avyno,

I hope you already found the solution. I’m posting the answer for other people who may have the same question.

Luckily, I found the solution after playing around a bit.

Open Dev Mode → Hover over your dynamic page and click on the “…” → Click on settings → under Page Info, you’ll find an option to “Add hooks”. Click on it
->select beforeRouter option.

A router.js page gets created. Here you can type in the following code:

import wixUsers from ‘wix-users-backend’ ;
import { redirect, next } from ‘wix-router’ ;

export function member_beforeRouter(request) {
console.log( “reached router” );
if (wixUsers.currentUser.loggedIn) {
console.log( “user logged in” );
return next();
} else {
console.log( “redirecting to home” );
return redirect( “https://www.kaviartstudio.in” );
}
}

My database name is : Members
The link I wanted to redirect was the home page.