Carlo Di Domenico
Carlo Di Domenico

Reputation: 103

How upload files in root domain while in subdomain

I've a domain and a subdomain with this structure:

Domain: mydomain.com
Subdomain: m.mydomain.com (which "mydomain.com/mobile/" is the folder)

While I'm on mydomain.com, I upload images to the folder "images", this is the structure:

mydomain.com/images/image.jpg

And I've no problems with it, because the folder /images/ is in the domain.

Now, when I'm in m.mydomain.com, how can I upload images to the domain folder (mydomain.com/images) and not to the subdomain folder (m.mydomain.com/images)?

Thank you guys

PS. I'm using Routing with both domains, with the index.php as "router"

Upvotes: 0

Views: 698

Answers (1)

danielson317
danielson317

Reputation: 3288

  1. Since m.domain.com is in domain.com you can use m.domain.com/images for both.

  2. Use the same directory for both domains and use .htaccess to route the mobile to index.m.php or something like that in the same directory.

  3. More complicated. You can serve files through a url page built in php. Basically just a page that takes the file name searches for it in the server directory outside the site and dumps the content with appropriate headers.

  4. Similar to 2 you can route both mobile and normal to the same directory. Detect in index.php if the subdomain is specified and load the site files from your mobile folder. This is my preferred method.

Upvotes: 1

Related Questions