Hello!

I'm looking for a good solution how to change the output file location. By default all file paths in Drupad lead to /sites/sitename.com/files/.. but i'm trying to change that so that all paths will be changed to links to static domain like http://static.sitename.com.

Is it possible to do that within a Drupal Theme?

Thanks!

Comments

V I R U S’s picture

Sorry for bumping, but still no solution found.

Raf’s picture

File/image upload fields, or WYSIWYG editor uploads (like FCK Editor or Tiny MCE, or the IMCE module)?

V I R U S’s picture

No, that's not what i mean.

Raf’s picture

You mean for stuff like the favicon and such then?

V I R U S’s picture

Currently for stuff located in /sites/mypage.com/files/

Raf’s picture

That is the folder all those things I mentioned get uploaded to... Anyways, check yoursite.com/admin/settings/file-system out. You should be able to configure it there. I think it'll have to be in the same domain as the site is, so setting a subdomain might not work. I can't guarantee whether it really won't work, though, so it's worth just giving it a try. Keep in mind that changing that path can create a mess (as the warning on admin/settings/file-system says, too), regardless of it going to the same domain or to a subdomain.

V I R U S’s picture

Hmmm... Houston, we have a problem =))

I know what you mean, but what i mean other thing. I have nothing about that all files are uploaded to /sites/mysite.com/files.

My thing is, that i will create a subdomain like static.mysite.com which will point to /sites/mysite.com/files and then change all links which appears in HTML from /sites/mysite.com/files/.../filename.gif to http://static.mysite.com/.../filename.gif.

The question is, how should i replace all that links?

Raf’s picture

Ohhhhhh, you want to know if you have to transfer those when you got a multisite setup. Nah, Drupal gets all it needs for each site in a multisite setup from the sites/[site name] folder. So if you keep the files in that files folder, things'll be just fine.

So basically, just set up the subdomain, link it to that mysite.com in the sites folder and Drupal will handle the files folder.

V I R U S’s picture

Please read my post again.

Raf’s picture

Oh, sorry. Didn't see that last line. Use the global var $base_url instead of the domain part. So it'll be like this:

<?php
$your_path = $base_url . '/files'; 
?>

And now I hope I understood your question right for a change :P

V I R U S’s picture

That will affect the drupal Complete, not only the files.

Raf’s picture

How do you mean?

V I R U S’s picture

You simply don't get what i need =)

Raf’s picture

Yeah, I guess so. As far as I understand, this is the whole issue:

Situation
  1. You got a theme that's currently running on mysite.com
  2. That theme uses files from sites/mysite.com/files
  3. To use those files, a link to them is placed in the theme
Task

What you now want to do, is use that theme in a subdomain (static.mysite.com) and want the theme to still use the files in sites/mysite.com/files

Is this correct?

V I R U S’s picture

No, i don't want to use that theme in a subdomain. I want to use it on a real domain and fetch files from subdomain.

Raf’s picture

So you got files in static.mysite.com/files and you want to use them in mysite.com/files?

V I R U S’s picture

Yeah, something like that. I've explained that already in the first post. No need to repeat it twice.

Raf’s picture

Yeah, check my answer to that. No need to repeat that twice either :P

V I R U S’s picture

Sorry, but all what you wrote is a total miss. Nothing what could help to solve the problem.