# Specify 7 running on a subdomain

**URL:** <https://speciforum.org/t/specify-7-running-on-a-subdomain/2199>\
**Category:** Get Help\
**Created:** [December 20, 2024, 4:39pm UTC](https://speciforum.org/t/specify-7-running-on-a-subdomain/2199 "2024-12-20T16:39:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [December 20, 2024, 4:39pm UTC](https://speciforum.org/t/specify-7-running-on-a-subdomain/2199/1 "2024-12-20T16:39:20Z")

</div>

Hi,  
I’m trying to run the dockerized SP-7 on a subdomain (ex: [https://mydomain.com/mysub/](https://mydomain.com/mysub/)) rather than on the root domain (ex: [https://mydomain.com](https://mydomain.com)).

However, the application is always redirecting my requests to the root domain. For example, when I do this request… [https://mydomain.com/mysub/](https://mydomain.com/mysub/) I’m redirected to [https://mydomain.com/specify/](https://mydomain.com/specify/) rather than [https://mydomain.com/mysub/specify/](https://mydomain.com/mysub/specify/)

This redirection to the root domain doesn’t seem to be executed by the nginx container.  
If you have any suggestion, please let me know.  
Thanks

---

<div class="post-metadata">

**Author:** ![markp](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/markp/32/1184_2.png) [@markp](https://speciforum.org/u/markp)\
**Post date:** [December 20, 2024, 5:29pm UTC](https://speciforum.org/t/specify-7-running-on-a-subdomain/2199/2 "2024-12-20T17:29:59Z")

</div>

Hi @Heryk,

Do you mind if I ask what the purpose of the subdirectory is? Are you trying to have one server have different instances of specify for people to use? If so, subdomains may be the solution, but sudomains would look like this:

`https://subdomain.example.com`

These work well, and is how specify cloud seperates out the different services on the [specifycloud.org](http://specifycloud.org) domain.

I don’t have as much experience configuring services that use the subdirectory approach, however there are some services that do work with that method. The one that comes to mind is mkdocs, in which the base url is configured as an environment variable, which can included a path. GitHub pages also seperates out different repositories within a organization through subdirectories, since it has already split up `github.io` subdomains among organizations/users.

I don’t think that subdirectories would work as well in specify due to how the urls are setup. For example, the specify route and favicons are coded as an absolute path, which I believe explains why you are experiencing the redirection the way you are.

> <https://github.com/specify/specify7/blob/f009a39aad43f303f31ed3028dbe0bba94f9c987/specifyweb/urls.py#L26C1-L30C85>

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [December 20, 2024, 5:43pm UTC](https://speciforum.org/t/specify-7-running-on-a-subdomain/2199/3 "2024-12-20T17:43:46Z")

</div>

> [@markp](#):
>
> I don’t think that subdirectories would work as well in specify due to how the urls are setup. For example, the specify route and favicons are coded as an absolute path, which I believe explains why you are experiencing the redirection the way you are.

That’s correct—Specify 7 does not support the use of a subdirectory in the base URL, but we do support subdomains.

@Heryk – is that a viable option in your case?

---

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [December 20, 2024, 5:48pm UTC](https://speciforum.org/t/specify-7-running-on-a-subdomain/2199/4 "2024-12-20T17:48:47Z")

</div>

Hi Mark and Grant,

I’ve received our new internal production server and will be migrating our SP-7 instances to it soon.

Our IT team suggested using a subdirectory structure for the setup, as it simplifies our internal domain management and SSL request process by requiring just one domain (ex: [https://collections.cfs.nrcan.gc.ca](https://collections.cfs.nrcan.gc.ca)) instead of several. For example:

- [https://collections.cfs.nrcan.gc.ca/herbaria](https://collections.cfs.nrcan.gc.ca/herbaria)
- [https://collections.cfs.nrcan.gc.ca/fungaria](https://collections.cfs.nrcan.gc.ca/fungaria)
- [https://collections.cfs.nrcan.gc.ca/invertebrata](https://collections.cfs.nrcan.gc.ca/invertebrata)

However, after testing, it seems that SP-7’s URL structure isn’t compatible with this approach.

Thanks for your input on this. I’ll be reverting to the previous setup using subdomains:

- [https://herbaria.collections.cfs.nrcan.gc.ca](https://herbaria.collections.cfs.nrcan.gc.ca/)
- [https://fungaria.collections.cfs.nrcan.gc.ca](https://fungaria.collections.cfs.nrcan.gc.ca/)
- [https://invertebrata.collections.cfs.nrcan.gc.ca](https://invertebrata.collections.cfs.nrcan.gc.ca/)

Cheers
