douxuzui4590 2014-04-04 00:01
浏览 135
已采纳

根据条件将文档根目录内部重定向到另一个文件夹

I currently have the following setup:

*.mysite.com --> /home/public_html/app/index.php

I want to write some code in index.php that changes the whole document root to /home/public_html/app_prev/index.php based on a condition. The reason for this is that I am doing a migration and if they haven't been migrated yet, I want to serve the old version of the code; once they are migrated. Each user has their own database and I will migrate 1 by 1. Normally it would take seconds to migrate all of them, but this release will take awhile to do.

  1. Is this possible?
  2. Is this recommend when making large database schema changes? Will it cause performance problems/errors?
  • 写回答

1条回答 默认 最新

  • dtcwehta624485 2014-04-04 00:18
    关注
    1. You could just use a PHP redirect based on the condition that you're looking for. It's no different then serving a different page based on what's coming in.
    2. It's a reasonable implementation if you have many large databases and you're worried about performance. I'd test it by
      1. Keep the old code path and old database.
      2. Migrate a test database over to the new codebase. I don't know how you're doing your logic, but you could have a single column, one entry table in each database that describes whether it's on the old or new code base.
      3. Test that the new codebase works.
      4. Start migrating your databases over, changing that single entry in each database (or however your logic is determined).
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能