简体   繁体   English

一个域在不同服务器上工作

[英]One domain working on different servers

I have a wordpress site on share-hosting server and I want to use a php script that it cannot run on the share-hosting one. 我在共享托管服务器上有一个wordpress网站,我想使用一个无法在共享托管服务器上运行的php脚本。

So I was thinking if I can have on Share-hosting (Server1) the wordpess site (http:// mysite dot com) and when someone types the url path (http:// mysite dot com/php-script) he will be directed to the VPS Server (Server2) which the php-script will run. 所以我在想,如果我可以在Share-hosting(Server1)上拥有wordpess网站(http:// mysite dot com),当有人键入url路径(http:// mysite dot com / php-script)时,他将定向到将运行php脚本的VPS服务器(Server2)。

Is that possible? 那可能吗? And how can I do it? 我该怎么办呢? If not what do you have on mind that I can do? 如果不是,您在想我能做什么?

Thanks for your time :) 谢谢你的时间 :)

This is possible when you create different subdomains. 当您创建其他子域时,这是可能的。

If you set up a subdomain in your DNS-settings like 'server2.address.lol', you can redirect everything for that subdomain to another IP-address and so to another server. 如果您在DNS设置中设置了一个子域(例如“ server2.address.lol”),则可以将该子域的所有内容重定向到另一个IP地址,然后重定向到另一个服务器。

you just have to create an A-record. 您只需要创建一个A记录。

After you set this up, you can redirect to the PHP-file on that subdomain. 设置完之后,您可以重定向到该子域上的PHP文件。 Example: http://server2.example.lol/script.php 示例: http//server2.example.lol/script.php

Are you able to create subdomains to your domain? 您可以为您的域创建子域吗? Then you could link to http://vps.example.com/script.php instead of http://example.com/script.php and redirect the subdomain to your second VPS. 然后,您可以链接到http://vps.example.com/script.php而不是http://example.com/script.php ,并将子域重定向到第二个VPS。

Alternatively, if you got access to mod_rewrite, you could perform a 302 redirect: 或者,如果您有权访问mod_rewrite,则可以执行302重定向:

RewriteEngine on
RewriteRule ^/script.php(.+) http://your-other-example.com/script.php$1 [R,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将图像从一个域发送到托管在不同服务器上的另一个域 - How to send images from one domain to other domain hosted on different servers 如何使用相同域的不同/服务器? - How to have different /servers with same Domain? html charset在2台服务器上工作不同 - html charset working different on 2 servers 一个用户数据库,两个不同服务器的应用程序 - One user database, two applications at different servers 为什么strtotime()在不同服务器上的工作方式不同? - Why is strtotime() working differently on different servers? file_get_contents在其他服务器上不起作用 - file_get_contents not working on different servers 从单个域后面的多个服务器之一动态地为用户提供服务? - Dynamically serving users from one of the multiple servers behind a single domain? 将一个数据库中的数据插入另一台服务器上的另一个数据库中-未链接的服务器 - Insert data from one DB into another on a different server - servers not linked 在两个不同的服务器上执行相同的查询,但其中一个似乎失败 - performing the same query on two different servers but one seems to fail mysql_real_escape_string不能在不同的服务器上运行 - mysql_real_escape_string not working on different servers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM