Mobile app version of vmapp.org
Login or Join
Goswami781

: 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

@Goswami781

Posted in: #Wordpress

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).

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Goswami781

1 Comments

Sorted by latest first Latest Oldest Best

 

@Jamie184

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme