function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jake JeonJake Jeon 

How do I able to set landing page according to user's profile

In order to implement my question, I tried overriding SiteLoginController like as below.
global PageReference login() {
    User getProfile = [SELECT ProfileId FROM User WHERE Username=:username]; 
    if(getProfile.ProfileId == '00e9D000000LswSQAS' || getProfile.ProfileId =='00e9D000000LtAZQA0'){
      String tempUrl = '/lightning/n/(pageName)';
        return Site.login(username, password, tempUrl);
    }else{
       String startUrl = System.currentPageReference().getParameters().get('startURL');
        return Site.login(username, password, startUrl);
    }
}


It worked without any problem at first. but when I login again after logout, It seems like forcing to get to the latest page I saw.
Is there any way to make user always redirect to the page I set after login?