0

有没有办法制作域/网址特定页面?

mysite.com 的主页与 mysite.net 不同

是路由还是页面内的一些查询?

4

1 回答 1

0

There is no such thing called domain specific pages, They do to keep things dynamic is that, they load the page details according to the domain

Ex:

in rails you could get the ip by request.ip, then in the table you have the details for a given page according to the ip

simple example would be, say you have the following table

sites
------------------------------
| id | site_name | ip         |
------------------------------- 
| 1 | demo site | 192.168.0.1 |
-------------------------------

pages
-------------------------------------------
|id | page_name | page_content | site_id |
-------------------------------------------
| 1 | home      | some content | 1       |
-------------------------------------------

when you load the home page. you could get the current ip and from that you can find the site, once you have the site you can find all the pages according to that site

And to keep this dynamic pages more manageable you could make use of gems like liquid (http://liquidmarkup.org/)

check these screen casts we well

dynamic layouts

subdomains

于 2012-04-09T16:03:05.970 回答