Multiple vanity URLs for same content

I would like to have both vanity URLs in Rstudio Connect direct users to the same content. I am trying to avoid users not being able to reach the content due to case sensitivity. e.g. --> (shows content A) --> (shows content A)

Thank you for sharing this use case!! I presume you have had users complain about case sensitivity and that have been confused by trying to reach content?

We will definitely share this feedback with developers! One "option" that you can use today (although it is admittedly a bit of a hack):

  • Create a static HTML page with the following HTML in it:
<head><meta http-equiv='refresh' content='0; URL=/mycontent'></head>
  • Deploy this static HTML page to Connect and give it the vanity URL /MyContent
  • When users visit this page, their browser will automatically be redirected to your desired location

I started thinking about this, and another approach you could take is define a single Rmd that does this for you (and is configurable by an environment variable). Then you just deploy this to your Connect server many times as a redirector wherever you need it! :sunglasses: Granted, you end up with a whole bunch of random, useless content, but it gives you the behavior you want in the short term! :smiley: Plus, you could tag them all the same to easily find / remove if and when we have this as a more supported feature within Connect!

Because I found this intriguing, I made a trivial little example... I also created a manifest.json so you can easily deploy with git-backed deployment too :smile:


It sounds like the proposed solution requires both vanity URL (.../MyContent & .../mycontent) to be assigned to different content in Connect. When I try this Connect gives Error: Vanity path conflicts
It looks like vanity URLs are case sensitive accessing content but not for assigning vanity URL to the content.

Ahh!! You're right!! :scream:

Sorry about that!! So this pattern would work for multiple URLs, so long as they are not case insensitively the same :sob: I was so excited for my hacky workaround too, haha.

This definitely seems less than ideal! Thank you for sharing this! Definitely something we should find a way to improve in the product :smile: I will pass this detail along to the appropriate parties!

We've chatted this through with our team a good bit and will definitely keep this conversation going internally!! For the present, we recommend adopting an all-lowercase convention for Vanity URLs to simplify the cognitive load on users. That way casing can be ignored by just lower-casing everything as a user.

From the W3 URL standard:

URLs in general are case-sensitive (with the exception of machine names). There may be URLs, or parts of URLs, where case doesn’t matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive.

This explains why we match case sensitively. However, the case insensitive restriction is to prevent crafty publishers from being mischievous and hosting other content at /My-content and confuse users trying to arrive at /My-Content.

We will let you know if we make any product changes in this area!! Also, any changes would land at with new release notes :smile:

1 Like