Answers.Body: <p>The request segments will come back as an array, where each part between slashes will be an array element so <code>mysite.com/first/second/third</code> gives segments <code>[first,second,third]</code> </p>
  
  <p>If you're just looking for the first segment, you can try
  <code>(craft.app.request.segments|first == 'uk')</code>
  to get that information.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-11T14:05:57.663Z
Answers.Text: Unfortunately this doesn't work.
Answers.UserDisplayName: HeyImArt
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-11T18:27:55.547Z
Answers.Text: That should work. With ``devMode`` on, when you do a ``{{ dump(craft.app.request.segments) }}`` what are you getting?
Answers.UserDisplayName: RitterKnight
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-11T12:26:42.087Z
Answers.LastActivityDate: 2020-06-11T12:26:42.087Z
Answers.UserDisplayName: Greg Bowne
Answers.Body: <p>Assuming you're using Craft's <a href="https://docs.craftcms.com/v3/sites.html" rel="nofollow noreferrer">multi-site functionality</a>(?), you'll want to use something like <code>{{ currentSite.handle }}</code> to check which site they're on. For multiple sites configured to use sub-directories from a single domain name, the first segment of the URL is considered to be part of the <code>siteUrl</code> and will not be returned in the segments array.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-11T13:14:40.217Z
Answers.LastActivityDate: 2020-06-11T13:14:40.217Z
Answers.UserDisplayName: James Smith
Body: <p>I'm trying to declare if a user is on a /uk or /us version of the site.</p>
  
  <p>domain.com/uk/
  domain.com/us/</p>
  
  <pre><code>{% if (craft.app.request.segments == '/uk/') %}
  UK site
  {% endif %}
  </code></pre>
  
  <p>This doesnt work. Can anyone explain why and where I'm going wrong?</p>
  
  <p>Thank you</p>
  
Tags: <segments><getsegment>
Title: Request Segment URL
ThreadText: # Request Segment URL
  
  (Asked by: username_0 on 2020-06-11)
  
  I'm trying to declare if a user is on a /uk or /us version of the site.
  
  domain.com/uk/
  domain.com/us/
  
  ```
  {% if (craft.app.request.segments == '/uk/') %}
  UK site
  {% endif %}
  
  ```
  
  This doesnt work. Can anyone explain why and where I'm going wrong?
  
  Thank you
  
  **Tags:** segments, getsegment
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-06-11. Score: 2
  
  The request segments will come back as an array, where each part between slashes will be an array element so `mysite.com/first/second/third` gives segments `[first,second,third]`
  
  If you're just looking for the first segment, you can try
  `(craft.app.request.segments|first == 'uk')`
  to get that information.
  
  > **Comments:**
  > **username_0**: Unfortunately this doesn't work.  
  > **username_2**: That should work. With ``devMode`` on, when you do a ``{{ dump(craft.app.request.segments) }}`` what are you getting?  
  
  ---
  
  ### Answer by username_3 on 2020-06-11. Score: 2
  
  Assuming you're using Craft's [multi-site functionality](https://docs.craftcms.com/v3/sites.html)(?), you'll want to use something like `{{ currentSite.handle }}` to check which site they're on. For multiple sites configured to use sub-directories from a single domain name, the first segment of the URL is considered to be part of the `siteUrl` and will not be returned in the segments array.
  
  
  ---
  
  