Reputation: 741
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.
Upvotes: 6
Views: 22748
Reputation: 2121
This works for me
RedirectMatch 301 ^/xxx/(.*)$ http://xxx.domain.com/$1
Upvotes: 8
Reputation: 9007
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]
Upvotes: 16
Reputation: 32082
Using mod_alias:
Redirect permanent /video http://videos.codigofacilito.com/video
The keyword permanent
causes Apache to send an HTTP status of 301 Moved Permanently
instead of 302 Found
.
Upvotes: 7