<blockquote>
  <ol>
  <li>How to redirect directly to dashboard after logging in?</li>
  </ol>
</blockquote>

<p>Since your login form is on the front-end of the site, the <a href="https://craftcms.com/docs/config-settings#postLoginRedirect" rel="nofollow noreferrer">postLoginRedirect</a> should do what you're looking for.</p>

<p>You can see the logic Craft uses to determine where to send a user after a successful login here: <a href="https://github.com/craftcms/cms/tree/master-v2/src/controllers/UsersController.php#L1599-L1614" rel="nofollow noreferrer">https://github.com/craftcms/cms/tree/master-v2/src/controllers/UsersController.php#L1599-L1614</a></p>

<blockquote>
  <p>How to redirect directly to domain.com/login or homepage after signing out?</p>
</blockquote>

<p>You've got the <a href="https://craftcms.com/docs/config-settings#logoutPath" rel="nofollow noreferrer">logoutPath</a> config setting set <code>'login'</code>, which is going to log a user out as soon as they hit the <code>/login</code> URI, which probably isn't what you're looking for.</p>

<p>There currently isn't a config setting to decide where to send a user after they've been logged out, but you could write a very simple <a href="https://pluginfactory.io" rel="nofollow noreferrer">plugin</a> that listened to the <a href="https://craftcms.com/docs/plugins/events-reference#userSession-onLogout" rel="nofollow noreferrer"><code>onLogout</code></a> event and redirected to wherever you wished.</p>

CC BY-SA 3.0
2017-04-19T10:04:55.697Z
I decided to stay hassle-free and keep only registration page. Craft login screen is good, no need to overwrite. Thank you anyway.
curious
CC BY-SA 3.0
2017-05-16T13:28:17.530Z
Can I add a FR? Add a config setting for `postLogoutRedirect` that we can set.
Siebird
CC BY-SA 3.0
2017-05-16T19:38:53.067Z
@Siebird - Yup... just create one here: https://github.com/craftcms/cms/issues
Brad Bell
CC BY-SA 3.0
2017-04-18T22:20:00.587Z
2018-02-21T23:45:37.083Z
2018-02-21T23:45:37.083Z
Brad Bell
<ol>
<li>I have "manage" link that redirects to domain.com/login.</li>
<li>"login" is custom front-end page that after logging in redirects to homepage.</li>
<li>After logging in when I click "manage" again the domain.com/login redirects me to CP dashboard.</li>
<li>Signing out from CP redirects me to default Craft login page.</li>
</ol>

<hr>

<ol>
<li>How to redirect directly to dashboard after logging in?</li>
<li>How to redirect directly to domain.com/login or homepage after signing out?</li>
</ol>

<p>I'm also using <code>manager</code> as cpTrigger, and this is my config:</p>

<pre><code>'postLoginRedirect' =&gt; 'manager',
'logoutPath' =&gt; 'login',
'cpTrigger' =&gt; 'manager',
</code></pre>

<p>For some reason according to #1 postLoginRedirect doesn't take effect
same for #2 and logoutPath, maybe I'm using them in the wrong way?</p>

<p>login/index.html code:</p>

<pre><code>{% extends "login/_layout" %}
{% set title = "Welcome back, friend :)" %}
{% block content %}
          &lt;div class="box"&gt;

          &lt;form method="post" accept-charset="UTF-8"&gt;
          {{ getCsrfInput() }}
          &lt;input type="hidden" name="action" value="users/login"&gt;

            {% if errorMessage is defined %}
             &lt;article class="message is-danger"&gt;
              &lt;div class="message-body"&gt;   
               {{ errorMessage }}
              &lt;/div&gt;
             &lt;/article&gt;
            {% endif %}

            &lt;div class="field"&gt;
              &lt;p class="control has-icon"&gt;
                &lt;input class="input" id="loginName" type="text" name="loginName" placeholder="Email"&gt;
                &lt;span class="icon"&gt;
                &lt;i class="fa fa-envelope"&gt;&lt;/i&gt;
                &lt;/span&gt;
              &lt;/p&gt;
            &lt;/div&gt;

              &lt;div class="field"&gt;
              &lt;p class="control has-icon"&gt;
                &lt;input class="input" id="password" type="password" name="password" placeholder="Password"&gt;
                &lt;span class="icon"&gt;
                &lt;i class="fa fa-lock"&gt;&lt;/i&gt;
                &lt;/span&gt;
              &lt;/p&gt;
            &lt;/div&gt;

              &lt;div class="field"&gt;
              &lt;p class="control"&gt;
              &lt;label class="checkbox"&gt;
                &lt;input type="checkbox" name="rememberMe" value="1"&gt;
                Keep me logged in
              &lt;/label&gt;
              &lt;/p&gt;
            &lt;/div&gt;

              &lt;hr&gt;

              &lt;p class="control"&gt;
                &lt;button class="button is-primary" type="submit"&gt;Login&lt;/button&gt;
                &lt;a class="button is-default" href="{{ siteUrl }}"&gt;Cancel&lt;/a&gt;

              &lt;/p&gt;
          &lt;/form&gt;
          &lt;/div&gt;
            &lt;p class="has-text-centered"&gt;
              &lt;a href="{{ url('login/register') }}"&gt;Register an Account&lt;/a&gt;
              | 
              &lt;a href="{{ url('login/forgotpassword') }}"&gt;Forgot password&lt;/a&gt;
              | 
              &lt;a href="{{ url('contact') }}"&gt;Need help?&lt;/a&gt;
            &lt;/p&gt;
{% endblock %}
</code></pre>

CC BY-SA 3.0
2017-04-17T21:05:14.990Z
I'm having a hard time following.  Can you share your `domain.com/login` template code? "How to redirect directly to dashboard after logging in?" Are you referring to Craft's dashboard or a front-end dashboard that you've created.
Brad Bell
CC BY-SA 3.0
2017-04-18T14:09:59.000Z
Hi @BradBell
I'm referring to the Craft dashboard.
I added login/index.html template code to the question.
curious
CC BY-SA 3.0
2017-04-18T21:49:42.110Z
""login" is custom front-end page that after logging in redirects to homepage." If I'm following you, that's the current behavior you're seeing, but you want to change it to "1. How to redirect directly to dashboard after logging in?"
Brad Bell
CC BY-SA 3.0
2017-04-18T21:58:22.123Z
@BradBell exactly
curious
<control-panel><form><config><login>
Customizing front-end login/logout redirects
# Customizing front-end login/logout redirects

(Asked by: username_0 on 2017-04-17)

I have "manage" link that redirects to domain.com/login.
"login" is custom front-end page that after logging in redirects to homepage.
After logging in when I click "manage" again the domain.com/login redirects me to CP dashboard.
Signing out from CP redirects me to default Craft login page.



How to redirect directly to dashboard after logging in?
How to redirect directly to domain.com/login or homepage after signing out?

I'm also using manager as cpTrigger, and this is my config:
'postLoginRedirect' => 'manager',
'logoutPath' => 'login',
'cpTrigger' => 'manager',

For some reason according to #1 postLoginRedirect doesn't take effect
same for #2 and logoutPath, maybe I'm using them in the wrong way?
login/index.html code:
{% extends "login/_layout" %}
{% set title = "Welcome back, friend :)" %}
{% block content %}
          

          
          {{ getCsrfInput() }}
          

            {% if errorMessage is defined %}
             
                 
               {{ errorMessage }}
              
             
            {% endif %}

            
              
                
                
                
                
              
            

              
              
                
                
                
                
              
            

              
              
              
                
                Keep me logged in
              
              
            

              

              
                Login
                Cancel

              
          
          
            
              Register an Account
              | 
              Forgot password
              | 
              Need help?
            
{% endblock %}

**Tags:** control-panel, form, config, login
> **Comments:**
> **username_1**: I'm having a hard time following.  Can you share your `domain.com/login` template code? "How to redirect directly to dashboard after logging in?" Are you referring to Craft's dashboard or a front-end dashboard that you've created.  
> **username_0**: Hi @BradBell I'm referring to the Craft dashboard. I added login/index.html template code to the question.  
> **username_1**: ""login" is custom front-end page that after logging in redirects to homepage." If I'm following you, that's the current behavior you're seeing, but you want to change it to "1. How to redirect directly to dashboard after logging in?"  
> **username_0**: @BradBell exactly  

---

## 1 answers

### Answer by username_1 on 2017-04-18. Score: 1

> 1. How to redirect directly to dashboard after logging in?

Since your login form is on the front-end of the site, the [postLoginRedirect](https://craftcms.com/docs/config-settings#postLoginRedirect) should do what you're looking for.

You can see the logic Craft uses to determine where to send a user after a successful login here: <https://github.com/craftcms/cms/tree/master-v2/src/controllers/UsersController.php#L1599-L1614>

> How to redirect directly to domain.com/login or homepage after signing out?

You've got the [logoutPath](https://craftcms.com/docs/config-settings#logoutPath) config setting set `'login'`, which is going to log a user out as soon as they hit the `/login` URI, which probably isn't what you're looking for.

There currently isn't a config setting to decide where to send a user after they've been logged out, but you could write a very simple [plugin](https://pluginfactory.io) that listened to the [`onLogout`](https://craftcms.com/docs/plugins/events-reference#userSession-onLogout) event and redirected to wherever you wished.

> **Comments:**
> **username_0**: I decided to stay hassle-free and keep only registration page. Craft login screen is good, no need to overwrite. Thank you anyway.  
> **username_2**: Can I add a FR? Add a config setting for `postLogoutRedirect` that we can set.  
> **username_1**: @Siebird - Yup... just create one here: https://github.com/craftcms/cms/issues  

---

