I need help setting up a subdomain that points to a specific WordPress page. What I want is something like this:
store.example.com -> example.com/store
The tricky part is that I don’t want any redirects happening. When someone visits the subdomain, they should stay on that URL in their browser. Only when they click other links should the main domain show up.
My current setup includes Apache with mod_rewrite enabled, WordPress with permalink structure turned on, and PHP. Has anyone done this before? Looking for the best way to make this work without breaking anything else on the site.
Yes, this can be achieved by configuring Apache virtual hosts correctly. I implemented a similar configuration for a project where the subdomain pointed directly to a specific page within WordPress without causing any redirect. The key is to create a virtual host for your subdomain that shares the same document root as your main site. In the .htaccess file, you’ll need to use mod_rewrite to internally redirect the traffic to the intended WordPress page, making sure to include the [L] flag to prevent external redirects. It’s also essential to test your setup afterwards, as WordPress can sometimes interfere with custom routing, particularly with complex permalink settings.
I had good luck with WordPress multisite and domain mapping. Set up a multisite network where the subdomain works as a separate site but pulls from the same content database. No messy Apache configs needed, and you get clean URLs without redirects. The MU Domain Mapping plugin handles all the routing automatically - just configure it so store.example.com shows the same content as your main site’s store page. This approach is rock solid because it works with WordPress’s existing setup instead of fighting it. Just make sure your host supports multisite before you start.
i’ve done this with dns pointing n wp-config tweaks. just point ur subdomain dns to the same server, then modify wp-config.php to handle domain detection. add code checking if request’s from store.example.com, routing it internally without redirection. works great once u get it configured!