Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi I want all my uploads to be uploaded to a subdomain on my site instead of 'wp-content/uploads'

I created a subdomain cdn.mysite.com and i want all the uploads to go there instead.

I want my uploads to be cdn.mysite.com/uploads/year/month/mediafile

Just as the uploads automatically create a folder for the uploads i want it to do the same when uploading to the subdomain.

How can I accomplish this.

EDIT:

I found this plugin that is suppose to place the image path options back on wordpress but I'm not so sure i should use it, I don't know if it actually works, I don't want to mess anything up

http://wordpress.org/extend/plugins/wp-original-media-path/installation/

Also I found this tutorial of how to do this from the wp-config.php file but it's only explaining changing the name of the folder not changing the path as in placing a subdomain.

http://www.techgyd.com/how-to-change-media-uploads-folder-in-wordpress-3-5/17/

I want to try the second option, editing the wp-config.php file but I don't know how to edit that line of code for subdomains, also I'm afraid that if we do figure out how to add the subdomain option to the wp-config file that when I upgrade wordpress it will disappear and my images may mess up.

What should I do?

share|improve this question
add comment

1 Answer

Are the sites hosted in such a way that you could create symbolic link within your primary site's directory structure to the physical storage location of cdn.mysite.com? You'd be linking wp-content/uploads -> /path/to/storage/for/cdn.mysite.com/uploads .

You'd likely need both sites' hosting running under the same user, but if they're co-located, this might be as simple as a symlink.

share|improve this answer
    
yes they are hosted under the same user........ the way it's set up is that the root of mysite.com has a folder called files and the subdirectory cdn.mysite.com will point to that folder or is there another way to set this up –  Mihad Aiko Jan 31 '13 at 2:14
    
i just realized that by creating a subdomain on the site and the subdomain files actually linking to the folder on the site won't make the site go any faster and that was my intentions :( –  Mihad Aiko Jan 31 '13 at 2:22
    
Actually, it will. Most browsers have a limit to the number of connections they can make to a single domain at a given time. By putting some of your content in a subdomain, you increase that limit by at least a factor of 2. –  Matt Shelton Jan 31 '13 at 3:14
    
So, to answer your other question. If your directory layout looks something like this: site site/wp-content site/files site/files/cdn.mysite.com and you have shell access to it, you can create a symbolic link from within site/wp-content. The command would look something like: mkdir -p site/files/cdn.mysite.com/uploads ln -s site/files/cdn.mysite.com/uploads site/wp-content/uploads –  Matt Shelton Jan 31 '13 at 3:14
    
Matt, no need to use symlinks, it is possible to set two WP settings for that. Nowadays, they are in /wp-admin/options.php. –  brasofilo Jan 31 '13 at 3:16
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.