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 to point to this IP.

So I'd now like when someone browses to www.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).


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.* http://releases.example.com/$0 [R=301,L]

This does assume that you don't have any other URLs that start "releases" in the root of the main domain. $0 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.