开发者

How to access data from different domain

开发者 https://www.devze.com 2023-02-28 09:58 出处:网络
There is site http://abc.com (made in PHP, MySQL, Apache, Linux environment). Currently,MySQL on that server is unaccessible. So that it is unable to access data from http://abc.com.

There is site http://abc.com (made in PHP, MySQL, Apache, Linux environment). Currently, MySQL on that server is unaccessible. So that it is unable to access data from http://abc.com.

But, w开发者_运维百科e have FTP & Server's credentials of http://abc.com and lateset backup of MySQL DB.

In such case can we place that site's files on our external IP (Let say http://xyz.com) and accessed it from http://xyz.com (made in PHP, MySQL, Apache, Linux environment). So that any user accessed site from http://abc.com (But internally, it is runned from http://xyz.com).


put a .htaccess with a redirect to xyz.com in place. You would see xyz.com in your browser though. (that might be unwanted, because it shows you xyz)

@Nanne: You may also want to have a look on the apache mod_rewrite / mod_proxy modules which enable you to redirect without exposing xyz.com (the request is proxied instead of being redirected) see http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriteflags [P] flag.

@Ozzone So in your .htaccess File on abc.com - in case of an (e.g. database) error - you may want to put the following:

^(.*) http://xyz.com/$1 [P]


Options seem to be:

  • point the DNS of abc.com to the server of xyz.com. (preferred I'd say, but you need access to the DNS config.)
  • put a .htaccess with a redirect to xyz.com in place. You would see xyz.com in your browser though. (that might be unwanted, because it shows you xyz)
  • Do something like an iFrame secretly loading xyz.com on abc.com. Feels hackish.


Let me see if I understood your question very well? It is a kind of SaaS application? If yes, you can try to use database replication, to have your data available in another server if the one goes down.

But, you want to access an IP and redirect only internally to another IP, and the environment still being the same? What about your data stored, is it being the same? is It a replicated database or not? or you just want to redirect the IP address.?!?

0

精彩评论

暂无评论...
验证码 换一张
取 消