I am not asking for a technical solution, just a plain "what approach would you recommend" vis-a-vis SEO, crawlability and user experience.
Imagine I am selling pastry on my website (let's call it pastry.com). I would like people specifically searching for cakes on google to go to my subdomain "cake.pastry.com" (listed as such on Google).
But, since I don't want to maintain multiple subdomains, "cake.pastry.com" would actually redirect to "pastry.com#cake", so that this approach could also be used for cupcakes and muffins! "cupcake.pastry.com" redirects to "pastry.com#cupcake", etc.
What would be the best way to do this? Is it possible to keep "cake.pastry.com" in the address bar while users are actually redirected "pastry.com#cake"? Would this pose a UX problem? Also, will this subdomain bring any value? I.e., will people searching for cakes on google actually find the "cake.pastry.com" subdomain higher than the root domain (because of keyword density, specificity of content...)? Would I need a 301 or 302 redirect? Via PHP or .htaccess?
So please, any opinion is welcome! Thank you!