[英]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.