Answers.Body: <p>Sure, something like this should work (untested):</p>
  
  <pre><code>&lt;a href="{{ currentUser ? url(craft.config.get('postLoginRedirect')) : siteUrl }}"&gt;Home&lt;/a&gt;
  </code></pre>
  
  <p>The above should create an absolute URL to whatever's in your <code>postLoginRedirect</code> config setting, relative to your <code>siteUrl</code>.</p>
  
  <p>Note that if you want an URL relative to your Control Panel (e.g. "dashboard"), you'll want to use <code>cpUrl()</code> instead, i.e.</p>
  
  <pre><code>&lt;a href="{{ currentUser ? cpUrl(craft.config.get('postLoginRedirect')) : siteUrl }}"&gt;Home&lt;/a&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-17T23:16:45.743Z
Answers.Text: Just noticed that with 'postLoginRedirect' => 'dashboard' using the solution above makes the postLoginRedirect a relative link, so it doesn't work on sub-pages. Can you think of a solution besides hard coding an absolute link like 'postLoginRedirect' => '/dashboard'
Answers.UserDisplayName: Keith
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-17T23:22:13.863Z
Answers.Text: @Keith You're correct – just updated the answer with a solution.
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-17T00:21:02.520Z
Answers.LastActivityDate: 2016-02-17T23:21:44.477Z
Answers.LastEditDate: 2016-02-17T23:21:44.477Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I know I can set  <code>postLoginRedirect</code> in config/general.php to send the user to a specific page after login. Is there a way to grab that value in the template? This came up because I noticed that the <code>{{siteUrl}}</code> href in the default <code>_layout.html</code> template was sending the user to the homepage (index.html), but I'd like to conditionally replace that link for a logged-in user.</p>
  
Tags: <redirect><redirection>
Title: Changing the "homepage" url for logged-in users
ThreadText: # Changing the "homepage" url for logged-in users
  
  (Asked by: username_0 on 2016-02-16)
  
  I know I can set `postLoginRedirect` in config/general.php to send the user to a specific page after login. Is there a way to grab that value in the template? This came up because I noticed that the `{{siteUrl}}` href in the default `_layout.html` template was sending the user to the homepage (index.html), but I'd like to conditionally replace that link for a logged-in user.
  
  **Tags:** redirect, redirection
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-02-17. Score: 3 | Accepted answer
  
  Sure, something like this should work (untested):
  
  ```
  <a href="{{ currentUser ? url(craft.config.get('postLoginRedirect')) : siteUrl }}">Home</a>
  
  ```
  
  The above should create an absolute URL to whatever's in your `postLoginRedirect` config setting, relative to your `siteUrl`.
  
  Note that if you want an URL relative to your Control Panel (e.g. "dashboard"), you'll want to use `cpUrl()` instead, i.e.
  
  ```
  <a href="{{ currentUser ? cpUrl(craft.config.get('postLoginRedirect')) : siteUrl }}">Home</a>
  
  ```
  
  > **Comments:**
  > **username_0**: Just noticed that with 'postLoginRedirect' => 'dashboard' using the solution above makes the postLoginRedirect a relative link, so it doesn't work on sub-pages. Can you think of a solution besides hard coding an absolute link like 'postLoginRedirect' => '/dashboard'  
  > **username_1**: @username_0 You're correct – just updated the answer with a solution.  
  
  ---
  
  