I need advice regarding massive 301 redirects

AI-generated summary

The discussion revolves around managing massive 301 redirects for a Discourse forum migration from a subdomain (xxx.domain.com) to the root domain (domain.com).

skozz is seeking advice on the best approach, mentioning the importance of 301 redirects for SEO purposes. maiki suggests using a single line in .htaccess or similar, but skozz points out that Discourse is not running Apache.

supermathie recommends configuring a webserver to 301 redirect all requests, providing an example configuration for Nginx. Meanwhile, pfaffman raises a concern about potential SEO issues, suggesting a consideration of using the www subdomain instead.

Finally, Idan asks about the location of the file for adding redirect commands in a Docker-based Discourse installation, as they cannot find the Nginx configuration.

Hola! after searching in the Meta and Google I’m not sure what’s the best way to proceed.

Background

I have a community with 15,8k topics, 967k posts, tons of images linked to S3. The forum is running under a subdomain (xxx.domain.com), and this yeah I want to migrate it to the root domain (domain.com)

Where am I lost?

I’m not an SEO expert, but as far as I know, the best way is forcing the 301 redirections, so that Google understands the change and it doesn’t affect to the positioning nor PageRank.

I know how to do this kind of redirection in custom websites or CMS like WordPress, but I’m not sure how to address this massive redirection with Discourse.

Is there something like best practices with Discourse?

Thanks, and sorry for the hassle.

I don’t think there is anything specific to Discourse.

When I do this I normally use a single line in .htaccess or similar:

Redirect 301 / https://example.org

I’ve achieved this with a plugin for a site migrated from wordpress. As Wordpress uses slugs in the url which are almost similar to discourse slugs, I’ve created such a rule via the plugin.

It redirects url.com/slug → url.com/t/slug

Thanks for you answer: how are you using .htaccess exactly? as far as I know Discourse is not running Apache :thinking:

The easiest approach here is to configure a webserver on xxx.domain.com to 301 Redirect all requests to domain.com

For example:

https://tecadmin.net/nginx-redirect-https/

but adapted to something like:

server {
	server_name xxx.domain.com;
	
	return 301 https://domain.com$request_uri;
}

I’m not an SEO expert either, but it seems like you’re asking for trouble. Have a look at Ojktoto > Ada Togel Online Terbaik Di Situs Toto Terpercaya, for example.

Where is the file where I put the redirect commands. I can’t find nginx anywhere on my Docker-based Discourse installation.