Redirect directory to a subdomain

.htaccess, redirect

Solution

If you need this rule to only be applied to the video route, then give the following a try:

In your document root's `.htaccess` file, insert the following rule:

RewriteRule ^(video/.*)$ http://videos.codigofacilito.com/$1 [R=301,L,NC]

Problem

I have my domain pointed to a Rails app in Heroku, so for example, when you wanted to access some video, you would have an URL such as: `http://codigofacilito.com/video/W53XHWkbz34` We need to change that app to a subdomain, so the updated version would be: `http://videos.codigofacilito.com/video/W53XHWkbz34` What I want to know is: Is there a way to redirect people to the new url with the subdomain videos by using the .htaccess file.

Original source