【问题标题】:How can I configure rails to not use 'www' for my website?如何配置 Rails 以不为我的网站使用“www”?
【发布时间】:2013-06-22 10:29:31
【问题描述】:

我不确定这个设置在哪里。目前我的网站将每个非 www 的 URL 重定向到 www。我正在使用 Rubber gem 部署到 AWS,而 AWS 又使用Passenger,并且我看到一些帖子表明此配置取决于Passenger。我正在使用 Apache 2

【问题讨论】:

标签: ruby-on-rails apache passenger rubber


【解决方案1】:

此任务通过正确配置服务器的虚拟主机(不是 RoR 或Passenger)来完成。

您应该在您的网络服务器(apache、nginx、..)上本地化主机文件并输入如下内容:

<VirtualHost *:80>
    DocumentRoot /www/example1
    ServerName example.com

    # Other directives here
</VirtualHost>

也许这个链接可以帮助你: http://httpd.apache.org/docs/trunk/vhosts/examples.html

【讨论】:

  • 有重写规则。谢谢!
猜你喜欢
  • 2015-10-24
  • 2022-11-25
  • 2016-08-01
  • 2015-06-29
  • 1970-01-01
  • 1970-01-01
  • 2011-06-29
  • 1970-01-01
  • 2017-06-29
相关资源
最近更新 更多