Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect directory to a subdomain

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.

like image 326
Uriel Hernández Avatar asked Nov 28 '22 11:11

Uriel Hernández


1 Answers

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]
like image 99
Mike Rockétt Avatar answered Nov 29 '22 23:11

Mike Rockétt