Question

I need to include a url with php from my base domain www.site.it in some pages from a third level domain (www.cms.site.it). I know that include external files is possible by enable the php.ini commandsa allow_url_include and allow_url_fopen, but this is not possible with my provider. Maybe it's some other possibility since it is always the same domain?

Was it helpful?

Solution

If the files lay on the same file system and you have access to them via your php script you should be able to include them.

Domains are just pointing to an IP and the server is showing the required content, so basicly you can have: a.example.com pointing on one server and b.example.com pointing on another server. If should be clear that you cannot include a file from the one server to the other.

When multiple sub-domains are involved in most of the cases they are on the same server and on the same file system but the scripts for each sub-domain are located in a folder and have access only in the current folder so in most cases you will not be able to do it.

If you have access to the files from the file-system the domains and the sub-domains have no role in this.

Finally - when it comes to shared hostings most domains and sub-domains are located in separate folders and the scripts in them have access to the current folder only. This is done for security reasons so in your case if you have a sub-domain that is yours you will not be able to access the files used in the main domain in the shared hosting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top