简体   繁体   English

如何使用Rails将URI重定向到Suburi

[英]How to redirect uri to suburi with rails

I've read up on how to use config.action_controller.relative_url_root to set a sub uri in rails and I plan to set my site to www.mydomain.com/mysub_uri. 我已经阅读了有关如何使用config.action_controller.relative_url_root在rails中设置sub uri的信息,并且我计划将我的网站设置为www.mydomain.com/mysub_uri。

What I would like thought is for www.mydomain.com to redirect automatically to www.mydoamin.com/mysub_uri. 我想让www.mydomain.com自动重定向到www.mydoamin.com/mysub_uri。

How do I go about doing this? 我该怎么做呢? I am using rails, apache, and phusion. 我正在使用rails,apache和phusion。

Thanks! 谢谢!

You could do this with an Apache rewrite (completely independent of Rails). 您可以通过Apache重写(完全独立于Rails)来做到这一点。 Check the docs here: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html 在此处检查文档: http : //httpd.apache.org/docs/2.0/misc/rewriteguide.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Ruby on Rails中使用括号将URI重定向 - How to redirect a URI with a parenthesis in Ruby on Rails Rails路由重定向上的URI :: InvalidURIError - URI::InvalidURIError on rails routing redirect 如何配置nginx在SubURI上提供gitlabhq - How to configure nginx to serve gitlabhq on a SubURI Rails搜索将重定向到SubURI托管生产应用程序中的错误URL - Rails search redirects to incorrect url in subURI hosted production app 如何设置nginx以允许在Ubuntu 12.04上使用/ suburi访问? - How to setup nginx to allow access with /suburi on ubuntu 12.04? OAuth 2“ redirect_uri_mismatch:{”错误”:“ redirect_uri_mismatch”}” - Oauth 2 “redirect_uri_mismatch: { ”error“ : ”redirect_uri_mismatch“ }” in rails 如何在Rails上的Ruby中修复错误的URI(不是URI?):URI :: InvalidURIError - How to fix bad URI(is not URI?) in ruby on rails :URI::InvalidURIError Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails应用 - Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails app 如何将参数从当前URI复制到重定向URI? - How do I copy params from the current URI to a redirect URI? redirect_uri_mismatch。 使用Ruby on Rails与Google登录 - redirect_uri_mismatch. Login with Google using Ruby on Rails
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM