Redirect from Discourse to Outside

Hello

Old URL

https://discourse.example.com/t/tiles-image-gallery/81950

HTTP Status Code: 301 :arrow_down:

New URL

https://example.com/tiles-image-gallery/

HTTP Status: 200

How can I setup redirect like this?

Thanks

Hi, try Settings > Customize > Permalinks

2 Likes

Permalinks redirect inbound links to internal pages. If you’re migrating from a different platform you use them to catch old addresses to direct users to new addresses.

I’m not aware of anything within Discourse that will handle redirecting discourse URLs externally.

To clarify though, are you looking to redirect traffic, or just rewrite?

I need to make some external redirect.

Discourse is hosted at A subdomain

WordPress is hosted at A apex domain

Both are separated hostname, and need to exist.


I just want to redirect couple of topics from Discourse to WordPress blog post.

Both Permalink is different.

When I go to Discourse customize > permalink it doesn’t seems providing simple

from

And

To

Field which could have been easier to make redirect wherever I want.

You can use permalinks to redirect to outside URLs just fine.

Example: discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub

2 Likes

How this is possible, can you please provide me a screenshot how it can be done?

It’s exactly where @zcuric told you:

As you can see on my example it redirect a simple path, guide in the example, to an external URL.

I’m not sure it’s possible to do it with a URL that matches a topic path. That is not a common use case.

2 Likes

Yes, I don’t believe it will work with a topic URL, or any other URL that Discourse normally responds to. Try undeleting the topic, deleting all its replies, and replacing the first post with some text directing people towards a link to the applicable external website.

1 Like

Exactly, it caches simple redirect only for example if I set

/twitterdev

to

https://twitter.com/twitterdev

This works.

But I want to do Topic to External… where it doesn’t go external path.

From

https://discourse.example.com/t/tiles-image-gallery/(.*)

(I have added wildcard to match paginated URLs)

301 To my external application WordPress post permalink

https://example.com/tiles-image-gallery/

discourse.example.com redirecting to example.com is “external”. It is a different domain; “external” in this context is any domain not exactly
discourse.example.com.

Wildcard support isn’t a feature I’d expect in the redirects; they are meant for simple one off page things.

I would ask myself if folks go to paginated URLs; in my experience they do not.

I’d say you are good to go. :slight_smile:

1 Like

I am thinking from the search engines prospective where 301 is important.

I’m not a search engine, I wouldn’t know. :thinking: