今天和guanMac童鞋研究的subdomain配置终于有点头绪~~

 之所以会遇到种种难题,个人总结了一下,第一本人太菜,第二英语不好

 贴一下guanMac童鞋配置小结的链接:http://my.eoe.cn/guanmac/archive/6105.html

 在rails4.0中实现二级域名是没有rails3.0中的复杂,只需要几步就可以了!

  步骤如下:

  1. config/routes 中添加

    constraints(Subdomain) do
    get '/' => 'controllerName#actionName'
    end
  2. 在lib文档中添加一个 subdomain.rb
    class Subdomain
    def self.matches?(request) request.subdomain.present? && request.subdomain != "www"
    end
    end
  3. config/application.rb 中添加
    config.autoload_paths += %w(#(config.root)/lib )
  4. 在你的地址栏输入 www.lvh.me:3000 取代你的本地地址。

  • 相关知识点链接

http://railsapps.github.io/tutorial-rails-subdomains.html

https://github.com/RailsApps/rails3-subdomains

http://railscasts.com/episodes/221-subdomains-in-rails-3?view=asciicast

http://stackoverflow.com/questions/11056511/request-subdomain-is-not-being-set-in-rails-3-during-conditional-routing

最新文章

  1. iOS 隐藏状态栏
  2. BZOJ-2127-happiness(最小割)
  3. 四道简单DP
  4. Mac、Linux更换命令行svn diff为P4Merge、vimdiff
  5. Android中 int 和 String 互相转换的多种方法
  6. SlidesJS - 老牌的响应式 jQuery 幻灯片插件
  7. HNU 12812 Broken Audio Signal
  8. http header详解
  9. Angularjs 基于karma和jasmine的单元测试
  10. 在LINUX上创建GIT服务器
  11. splice() 方法通过删除现有元素和/或添加新元素来更改一个数组的内容。
  12. mysql 开发进阶篇系列 50 表的数据导入(load data infile,mysqlimport )
  13. 比MR至少快5倍的神器,竟然是它
  14. 大学jsp实验5request,response
  15. boost.lexical_cast 学习
  16. luogu P1776 宝物筛选_NOI导刊2010提高(02)
  17. 【转】《iOS7 by Tutorials》系列:iOS7的设计精髓(上)
  18. xencenter如何安装系统
  19. js网页上画图
  20. 2018.10.26 NOIP训练 数数树(换根dp)

热门文章

  1. [苏飞开发助手V1.0测试版]官方教程与升级报告
  2. 如何获得WPA握手包&EWSA破解WPA密码教程[zz]
  3. 【高德地图API】如何设置Icon的imageSize?
  4. Scala 深入浅出实战经典 第62讲:Scala中上下文界定内幕中的隐式参数实战详解
  5. asp Gridview绑定形式获取行号
  6. mysql性能瓶颈分析、性能指标、指标搜集方法与性能分析调优工具
  7. JAVA常见错误处理方法 和 JVM内存结构
  8. Akismet API 密钥(key)免费获取方法
  9. 随机抽样一致性算法(RANSAC)示例及源代码
  10. React-Native入门指导之iOS篇 —— 一、准备工作