将目录重定向到子域

编程入门 行业动态 更新时间:2024-10-19 13:27:47
本文介绍了将目录重定向到子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的域指向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:

codigofacilito/video/W53XHWkbz34

我们需要将该应用程序更改为子域,因此更新的版本将是:

We need to change that app to a subdomain, so the updated version would be:

videos.codigofacilito/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/.*)$ videos.codigofacilito/$1 [R=301,L,NC]

更多推荐

将目录重定向到子域

本文发布于:2023-11-01 02:08:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547939.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   目录   到子域

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!