将目录重定向到子域 [英] Redirect directory to a subdomain

查看:98
本文介绍了将目录重定向到子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的域指向Heroku中的Rails应用程序,因此,例如,当您要访问一些视频时,您将具有以下网址:

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

我想知道的是:

是否可以通过以下方式将人们重定向到带有子域视频的新网址使用.htaccess文件。

Is there a way to redirect people to the new url with the subdomain videos by using the .htaccess file.

推荐答案

如果您只需要将此规则应用于视频路由,请提供以下内容尝试:

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

在文档根目录的 .htaccess 文件中,插入以下规则:

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

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

这篇关于将目录重定向到子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆