Answers.Body: <p>Welcome @bobartlett to StackExchange. Within your templates you could test what the current <code>siteUrl</code> is and only show content based on that. In addition if you are on sub.domain.com then test if the <code>currentUser</code> is logged in.</p>
  <pre><code>{% if siteUrl == 'sub.domain.com' %}
      {% if currentUser %}
          {# user is logged in #}
      {% else %}
          {# show login #}
      {% endif %}
  {% else %}
      {# show normal content #}
  {% endif %}
  </code></pre>
  <p>A second method would be to create multiple <a href="https://craftcms.com/docs/4.x/sites.html" rel="nofollow noreferrer">sites</a> where the main domain goes to one site and the sub domain goes to the other. To keep your data the same on each site for most pages you would make sure to keep your translation <a href="https://craftcms.com/docs/4.x/fields.html#translation-methods" rel="nofollow noreferrer">settings for your fields</a> configured to &quot;Not translatable&quot;. For those pages you want different on the sub.domain.com site then just disable them for the domain.com site.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-11T15:52:36.827Z
Answers.Text: That is perfect! Many thanks
Answers.UserDisplayName: bobartlett
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-10T21:17:49.803Z
Answers.LastActivityDate: 2023-05-10T21:28:20.897Z
Answers.LastEditDate: 2023-05-10T21:28:20.897Z
Answers.UserDisplayName: a-am
Body: <p>Is this possible? I want domain.com and sub.domain.com to point to the same Craft installation. If you go to domain.com you see the normal site. If you go to sub.domain.com you are presented with a password prompt then you see the same content as domain.com plus additional content</p>
  
Tags: <password><subdomain>
Title: Expose certain content if on subdomain
ThreadText: # Expose certain content if on subdomain
  
  (Asked by: username_0 on 2023-05-10)
  
  Is this possible? I want domain.com and sub.domain.com to point to the same Craft installation. If you go to domain.com you see the normal site. If you go to sub.domain.com you are presented with a password prompt then you see the same content as domain.com plus additional content
  
  **Tags:** password, subdomain
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-05-10. Score: 2
  
  Welcome @username_0 to StackExchange. Within your templates you could test what the current `siteUrl` is and only show content based on that. In addition if you are on sub.domain.com then test if the `currentUser` is logged in.
  
  ```
  {% if siteUrl == 'sub.domain.com' %}
      {% if currentUser %}
          {# user is logged in #}
      {% else %}
          {# show login #}
      {% endif %}
  {% else %}
      {# show normal content #}
  {% endif %}
  
  ```
  
  A second method would be to create multiple [sites](https://craftcms.com/docs/4.x/sites.html) where the main domain goes to one site and the sub domain goes to the other. To keep your data the same on each site for most pages you would make sure to keep your translation [settings for your fields](https://craftcms.com/docs/4.x/fields.html#translation-methods) configured to "Not translatable". For those pages you want different on the sub.domain.com site then just disable them for the domain.com site.
  
  > **Comments:**
  > **username_0**: That is perfect! Many thanks  
  
  ---
  
  