Search code examples
phpwordpressdnsvpsnameservers

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.

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.

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 :)


Solution

  • 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.

    you just have to create an A-record.

    After you set this up, you can redirect to the PHP-file on that subdomain. Example: http://server2.example.lol/script.php