dtukyb8095 2011-07-05 22:12
浏览 16

创建特定于城市的网站(city1.example.com,city2.example.com)[关闭]

How do I make a website with subdomains catering to different cities?

Like http://philly.example.com, http://maine.example.com, http://sandiego.example.com? Most of the site will be the same, like the layout, the wordings, the database, the interface. What will be different will be some city-specific graphics like adding a city name to the logo (eg. Groupon Nyc, Groupon Chicago), changing a hidden variable (city) in the form that searches the database so results will be biased towards the city.

Question 1. User visits site. Script determines city from user's IP address then redirect to the correct subdomain.

I can do the detection script, but how do you display almost the same site to each of the different city? I guess you do not duplicate the site 50 times for 50 different cities, handling the changes to every site will be insane!

Question 2: Assuming you do not duplicate the site each time for a new city and change the images and text slightly, how do you do the city-specific changes then?

Do you have a list of 50 case-ifs or if-elseif-else for every city-specific item on the page? I foresee doing this will mess up the code for the entire page!

  • 写回答

4条回答 默认 最新

  • duagfgfn1981 2011-07-05 22:16
    关注

    Q1) You have the cities in a database and then whatever you want to show, you do by cityid.

    Q2) Again, show data by cityid.

    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题