: Wordpress redirect folder to subdomain I have recently redone my website in wordpress and moved it to a different server. I need www.example.com/releases to point to another IP. I have set releases.example.com
I have recently redone my website in wordpress and moved it to a different server.
I need example.com/releases to point to another IP.
I have set releases.example.com to point to this IP.
So I'd now like when someone browses to example.com/releases for the user to be redirected to releases.example.com/releases.
The reason we need this to happen is our software automatically checks that folder for new releases (and we don't want to have to update that part of the code).
More posts by @Goswami781
1 Comments
Sorted by latest first Latest Oldest Best
To redirect all requests for example.com/releases to releases.example.com/releases (and all requests within), place the following near the top of the .htaccess file (below RewriteEngine On) in the document root of the main domain:
RewriteRule ^releases.* releases.example.com/[CO] [R=301,L]
This does assume that you don't have any other URLs that start "releases" in the root of the main domain. [CO] corresponds to the entire pattern that is matched (the entire URL-path).
I've used mod_rewrite (as opposed to a mod_alias Redirect) since WordPress also uses mod_rewrite for rewriting and it's not good to mix the two.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.