Question

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

Was it helpful?

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

OTHER TIPS

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.

Alternatively, if you got access to mod_rewrite, you could perform a 302 redirect:

RewriteEngine on
RewriteRule ^/script.php(.+) http://your-other-example.com/script.php$1 [R,L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top