Liquid conditional logic producing different results on different machines

I have a simple Jekyll site that switches between Arabic and English versions of my pages with a language selector include, as follows:

<div class="language-selector">

  <!-- get opposite lang -->
  {% if page.lang == 'en' %}{% assign lang_change = 'ar' %}
  {% else %}{% assign lang_change = 'en' %}{% endif %}

  <!-- construct link differently for photo pages, index pages, and regular pages -->
  {% if page.layout == "photo-page" %}
    <a href="{{ baseurl }}/photopages/{{ lang_change }}/{{ page.ref }}.html">
  {% elsif page.ref == 'index' %}
    <a href="{{ site.index[lang_change] | relative_url }}">
  {% else %}
    <a href="{{ baseurl }}/{{ lang_change }}/{{ page.ref }}.html">
  {% endif %}

  <!-- print language and close link -->
  {% if lang_change == 'ar' %}العربية
  {% elsif lang_change == 'en' %}English{% endif %}
    </a>
</div>

Everything works perfectly on my end:

Regular pages go from /en/ref.html <–> /ar/ref.html
My index page knows to switch from the root <–> /ar/index.html and
Photopages switch from /photopages/en/ref.html <–> /photopages/ar/ref.html
However, when my repository is cloned and the site is built and put on the in Sudan, the photopages lose the “/photopages/” part of the link, so that:

/photopages/en/ref.html --> /ar/ref.html --> 404

Has anyone encountered anything like this? I’ve tried it on multiple machines, including an Ubuntu VM to mirror the prod server, but am unable to even reproduce the issue.

Example: http://sudanphoto.uofk.edu/photopages/en/NAS-01-001.html

I would guess that this part is the problem, no idea why it would work locally but not somewhere else.

What is the front matter for that page?

You could also compare the url with contains - if page.url contains "photopages" (something like that - just wrote that from memory so probably something wrong with it).