Moving from directory to subdomain

AI-generated summary

The user Ironclad14 is moving their Discourse forum from a subfolder (foo.bar/forum) to a subdomain (forum.foo.bar) and encountering issues with CSS loading and missing images. After changing the domain in app.yml and removing the subfolder remap, they face a broken site due to incorrect stylesheet paths (e.g., https://stylesheets/file.css) and 404 errors on uploaded images. Johani suggests safe-mode, but Ironclad14 reports an invalid redirect. Neil identifies the issue: the DISCOURSE_RELATIVE_URL_ROOT: / setting in app.yml is still active, which causes the subfolder behavior. Removing this line resolves the CSS issue Ironclad14. However, images remain inaccessible despite rebaking posts and verifying file existence. Ironclad14 tries restoring a backup and changing permissions, but the problem persists. Fabraz asks if Ironclad14 found a solution.

Hi guys,

To make my setup less complicated per @codinghorror’s advice, and since Let’s Encrypt now support subdomains, I decided to move my discourse from foo.bar/forum to forum.foo.bar

What I did:

Changed the domain name in my app.yml, removed the folder remap from custom commands, then remapped foo.bar/forum to forum.foo.bar via discourse remap, then I rebaked posts.

The problem is this:

When I open https://forum.foo.bar/ it’s trying to fetch https://stylesheets/etc which then causes the forum display to break and I can’t really log in or change the website theme.

What can I do to fix that?

If needed, here’s the installation url: https://forum.legiochristi.com/
My app.yml: ## this is the all-in-one, standalone Discourse Docker container template### - Pastebin.com

Any help would be appreciated.

Okay I managed to log into the admin panel but I can’t seem to change the default theme since it’s dependent on JavaScript to apply.

I also can’t download my latest backup. Is there a way to do this in command line? Either change the theme or download a backup?

Thanks.

Have you tried safe-mode?

your.site/safe-mode

I’m getting this error when I try:

Chrome says it’s an invalid redirect.

Is there a way to do it through command line?

If there is, I’m not aware of it.

Perhaps someone more knowledgeable can comment on that. :sunflower:

Hope so. I’ll probably nuke it and rebuild after I fetch my last backup.

You did a rebuild too? ./launcher rebuild app

Sure did.

The problem seems to be mostly that it’s trying to fetch https://stylesheets/file.css - I have no idea why that happened or how to fix it.

I see the files present in the container but they’re just not called correctly.

It’s actually using hostname stylesheets there? Or what is the actual url?

You haven’t given enough for us to help you. Can you post your container’s yml file after removing credentials?

Yes it’s actually using hostname stylesheets.

My app.yml is in the first post.

Your yml file still has the subfolder setting enabled:

DISCOURSE_RELATIVE_URL_ROOT: /

Delete that line from the file and rebuild again.

amazing

i’ll try that in a sec

Okay great that worked! Now the only thing left is to fix all my missing images. I’m getting a 404 on all uploaded avatars and uploaded images. Very odd.

Update:

All images return 404. I rebaked posts, recovered uploads from tombstone, and double-checked whether or not the images exist in the directories.

https://forum.legiochristi.com/uploads/default/original/1X/b104612ae2622e9ccfbb55197bb4e46059a7c171.png

this is 404

yet it exists both in /var/www/discourse/public/uploads/default/original/1X and in /shared/uploads/default/original/1X (which is symlinked successfully, therefor)

I’m at a loss here.

Okay I just restored a week old backup and that didn’t help.

I also tried to chmod the uploads directory to 777

Does anyone have any ideas?

@Ironclad14, I’m facing the same problem as you did. I was wondering whether you find out how to fix it. If so, could you share?

Thanks in advance!