• Resolved BeautyPirate

    (@beautypirate)


    Hello there,

    I am completely stuck here, maybe someone can help me find a solution.

    Issue history:

    – Set up subdomain images.mydomain.com to /www/wp-content/uploads

    So far so good.

    I put up a SQL order telling my server to reroute all http://www.mydomain.com/wp-content/upload requests to images.mydomain.com/

    Now… because I didn´t want to change the image urls on all the sites and posts I set up a 301 redirect in the .htaccess file also telling to reroute to images.mydomain.com.

    But it all does not seem to work because it is still loading most images via the main domain or it is not loading anything. But the header image for example loads via the subdomain for WHATEVER reason.
    And the thumbnails in WP Media Library are gone, too.

    Can someone please tell me the configuration of:

    – What exactly to put in WP/Settings/Media
    – What to tell SQL
    – What to put in .htaccess

    And what the heck I´m doing wrong?

    I didn´t know if it was appropriate to post my link here but I sure could do that to show you the Source code.

    Thanks a lot this would help me a lot as I´m stuck here for about 7 hours now…

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter BeautyPirate

    (@beautypirate)

    Solved it. Just had a little mistake in the .htaccess:

    Did NOT work:
    RedirectMatch 301 ^/wp-content/uploads/(.*)$ http://images.mydomain.com/$1

    DID work:
    RedirectMatch 301 /wp-content/uploads/(.*)$ http://images.mydomain.com/$1

    Why ever that was…

    What a wonderful surprise, @beautypirate, to see this post!! That did the trick for me, however, I’m wondering if you are able to upload images through your Media Library interface and have them be correct?

    I have it set within Media (in settings)
    Store uploads in this folder /media (it’s public_html/media)
    Full URL path to files http://media.mydomain.com

    But when I try to upload anything via the Media Manager, I get the following error:

    Warning: copy(/media/anacalypsis-vol-2-godfrey-higgins.jpg) [function.copy]: failed to open stream: Permission denied in /home/username/public_html/mydomain.com/wp-admin/includes/file.php on line 348
    1467

    Line 346-349 of file.php says:

    // Copy the temporary file into its destination
    	$new_file = $uploads['path'] . "/$filename";
    	copy( $tmp_file, $new_file );
    	unlink($tmp_file);

    Line 348 is the copy ( $tmp_file, $new_file );

    Do you (or anyone) have any ideas? I’m pulling my hair out over here… 🙁

    Not sure what changed (file CHMOD still 755) except eliminating the beginning slash in Store uploads in this folder.

    Anyway, it still shows the red ‘x’in the Media Manager when I upload an image, but at least it’s there. Whew!

    Thread Starter BeautyPirate

    (@beautypirate)

    I´m not sure where your subdomain points to exactly but here´s my Dashdoard->Settings->Media Preferences:

    – Store uploads in this folder: Leave this BLANK!
    – Full URL path to files: http://your.subdomain.com

    Also I have checked the box saying to create year, month folders.

    Assuming your subdomain points directly to www/wp-content/uploads/ then the above setting is correct. Adjust your subdomain settings rather than tweaking around with chmods because if you make a mistake there, your site may easier be compromised.

    Was that what you meant?

    Thanks for the response, BeautyPirate.

    Well, I think I got it worked out by eliminating the forward slash in the Store uploads in this folder field, however, it does not pick up the featured image well, which always looks like the ‘broken image'(rectangle with red x inside) and I’m left scratching my head as to how to fix that one niggling little thing. 🙁

    So I’ll try your method and leave that field blank and see what happens!

    I tried leaving that bit blank, and although I get no error message, it also isn’t actually uploading the image there! I’m going to open a new thread on this, hopefully some guru will see it and come to my rescue 🙂

    I’m struggling with this as well. Very frustrating. It seems that the WP programmers want to keep all the activity in the wordpress directory by tricking the browsers with redirects when what USERS want is to be able to save the darn files where they want them to! On the SUBDIRECTORY!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hosting images on subdomains, several errors’ is closed to new replies.