REST API not working in addon domain

I am new to php and server side processing.

I have a domain "www.example.co.in". And one more addon domain "www.example.com". I created a new folder "www.example.com" in the root folder (public_html) to raise the cpanel "www.example.co.in".

public_html-> www.example.com

Now I wrote an api in php fetch_data.php that looks like this:

<?php if(isset($_POST['test'])){ // db connection // retrieve data from database } else { echo("error") } ?> 

Now, if I put this file inside www.example.com ie public_html-> www.example.com → fetch_data.php

isset($_POST['test']) returns false.

And if I put the same file in the root folder i.e. public_html-> fetch_data.php

I can get the data.

Note. I use the same input.

URL: http://www.example.com/fetch_data.php <- isset not working

URL: http://www.example.co.in/fetch_data.php <- isset working

I am testing the above apis using the REST Easy extension for Firefox. Rest Easy by nathan-osman

Actual path of my cpanel:

Home / www.example.co.in / public_html /

And the addon domain:

Home / www.example.co.in / public_html / www.example.com /

+6
source share
3 answers

add this virtual host:

 ServerName example.com ServerAlias www.example.com www.example.co.in example.co.in 
+2
source

Godaddy provides shared hosting, where most of the settings have already been made. Apache configuration is also performed by the hosting partner.

You need to set different document_root for different domains. Check Godaddy documentation .

+1
source

I think you have chosen a single hosting plan and just parked an additional domain. You must have multi-domain hosting to host two or more domains on the same server. Since godaddy is a shared hosting, you do not have access to apache configuration files.

Instead, check out the amazon aws micro instance, which is free, and you can play a lot with it.

+1
source

Source: https://habr.com/ru/post/1013031/


All Articles