I have a CMS for my website which is hosted on the subdomain (admin.example.com). Both are in a different directory on the server. On the subdomain I upload all my files (mostly images) that are later to use on the main domain (example.com).
From the subdomain I upload file information to the database which is also used by the main domain, file_url, file_id etc. etc.
The thing is, how can I get hold of this information from my main domain? The file_urls currently look like ../folder/image.png and I don't want people, using the main domain, knowing that I have a subdomain which holds the CMS.
I was thinking about throwing everything on the main domain and restrict the admin area for default users. But what are your thoughts about this? is this safe? is there somehow a work-around?
UPDATE
Within a page from the subdomain.example.com I call this piece of code
$dir = "/usr/share/nginx/html/example.com/public_html/images/thumbnail";
try {
// Creating directory
mkdir($dir, 0755, true);
} catch(ErrorException $ex){
// Failure
die($warnings[] = "Error: " . $ex->getMessage());
}
exit();
This works, folders have 755 and files 644. It may be a dirty workaround but I am not aware of the consequences this may have. Please let me know!