Map domain to CPT page


#1

Trellis + Bedrock

I want to map extra domains to a specific CPT.
I don’t want to hardcode this into server config or adding extra code to trellis for this.
Is there a plugin or feature I can use for mapping domains to specific CPT page or URL?
Redirection plugin is less suitable because it actually redirects permanently and doesn’t offer a real URL.
Yoast SEO plugin is used which adds canonical information so the duplication issue with the CPT pages also reachable over the primary/main domain shouldn’t occur.


#2

Are you saying you want people to be able to visit specific posts on completely different domains? Or that you want posts in a CPT to be available on one domain while other content is on another domain? I feel like both of those would require URL rewrites at the server level. If you access a domain different from the one WordPress is on, WordPress isn’t there to intercept the request, so it can’t do anything.


#3

Yes, a domain should be mapped to a CPT page. There is the issue with duplicate content. Ideally, the main domain would link to the correct extra-domains to each CPT.


#4

This sounds like the perfect use case for WordPress multisite. This might leave a less than ideal way to edit content from a central dashboard, but from a pragmatic stand point you’ll hit less URL related issues this way. And you can also alleviate any dependencies on plugins where you’re uncertain of roadmaps for those.

If editing content from one central dashboard for all domains is important to you, functions such as switch_to_blog() can be utilised. But I’d advise against that.

If you could provide more information on the project requirements I could elaborate. But my advice to you, (after wrestling with WordPress’ URL rewriting many many times), is don’t go down this path of isolating CPTs to different domains