WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Media Upload File URL incorrect (28 posts)

  1. mediadisconnect
    Member
    Posted 2 years ago #

    I have searched the forum to find an answer but could not find one so I am posting a new thread.

    I am running WordPress 3.3.1 in a Multisite sub-directory configuration using Domain Mapping. My .htaccess file is proper(copied from network setup) and Apache is set to AllowOverride All.

    When I add media from one of the sites, the file gets uploaded and thumbnails are created in the proper directory (blogs.dir/4/files/04/2012/) but when looking at the media record the thumbnails are blank and the Filename URL is incorrect.

    FileName URL = http://domain.com/files/2012/04/IMG_0763.jpg
    The displayed URL produces a 404 error.

    If I browse to http://domain.com/wp-content/blogs.dir/4/files/2012/04/IMG_0763.jpg the file shows up properly.

    Inside the Sites settings:
    Upload Path: wp-content/blogs.dir/4/files
    Fileupload URL: domain.com/files
    Upload URL Path: blank

    I really am at a loss and have been working on this for about four days now. Everything else is working properly except for the adding of media.

  2. Does it do this on ALL subsites, or just the one?

    Did the images work when the site was NOT mapped? (You did check, right?)

  3. mediadisconnect
    Member
    Posted 2 years ago #

    This happens on all subsites.

    The uploading of images works perfect on the site that is not mapped.

  4. The uploading of images works perfect on the site that is not mapped.

    Do you have any subsites that are NOT mapped? I just want to be sure you mean 'My main domain, the original one I did not and cannot map, is fine. My subdomains, like domain.com/foo/, AND my mapped domains, like otherdomain.com, all fail.'

    It does matter :)

  5. mediadisconnect
    Member
    Posted 2 years ago #

    My original installation of WordPress was to domain.com

    I converted the WordPress installation to Multisite using subdirectories:

    domain.com/SubSite1
    domain.com/SubSite2

    I then mapped domain2.com to /SubSite1
    and domain3.com /SubSite2

    If I upload through WordPress on domain.com my thumbnails show up and path is correct for inserting into posts, pages, etc.

    If I upload through WordPress on either domain2.com or domain3.com non of my thumbnails show up and the File URL produces a 404.

  6. mediadisconnect
    Member
    Posted 2 years ago #

    The only domain that does not have mapping designated is from my initial install domain.com at /

  7. So no, you don't have any subsites that aren't mapped.

    Can you make one just for a quick test? It's either ALL subsites aren't getting images, or it's only mapped domains.

  8. mediadisconnect
    Member
    Posted 2 years ago #

    Ok, when I create a test site and don't map the domain, picture uploading words great.

    It appears that only those subsites that are mapped are having the problem.

    The Domain mapping plugin that I am using is WordPress MU Domain Mapping v0.5.4.2 by Donncha O Caoimh

  9. Do you happen to have hotlink protection in your .htaccess?

  10. mediadisconnect
    Member
    Posted 2 years ago #

    I don't have hotlink protection enabled.

  11. Double check that your server doesn't have it secretly enabled? Cpanel has a setting for it, IIRC.

    Are you using any caching plugins?

  12. mediadisconnect
    Member
    Posted 2 years ago #

    It is not secretly enabled. lol
    I double checked with the hosting company (Blue Host).

    I had a Caching plugin installed but I removed it completely a few months back when I noticed that it wasn't helping with my load times.

    If it helps I am posting my .htaccess file. I have had it two ways but neither have worked.

    ***** Original *******
    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php
    
    # BEGIN WordPress
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    ******END OF ORIGINAL VERSION*****************
    ****** Second version*******
    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    </IfModule>
    # END WordPress
    ***** END OF SECOND VERSION *******

    I don't want to impose but if you would like access to my hosting account and WordPress installation I would be happy to provide it.

  13. mediadisconnect
    Member
    Posted 2 years ago #

    I am sure the solution is something that has either been over looked or something I am not aware of.

  14. mediadisconnect
    Member
    Posted 2 years ago #

    I am not sure if this matters but when looking at the MySQL tables almost all of my tables use a collation of utf8_general_ci

    where both the wp_domain_mapping and wp_domain_mapping_logins tables use a collation of latin1_swedish_ci

    Again not sure if that really matters but I am grasping at straws.

  15. That shouldn't matter, but ... A quick check and all mine are utf8_general_ci

    If you've got PHPMyAdmin, pop open the DB and go to the "Operations" tab. Change " Collation:" to utf8 (which is 'better')

    How did you 'map' the domains outside of WP>?

    Also on domain.com/wp-admin/network/settings.php?page=dm_admin_page

    What 'Domain Options' did you check?

  16. mediadisconnect
    Member
    Posted 2 years ago #

    Changing the collation to utf8_general_ci did not work.

    In my cpanel I have the domains parked at Bluehost who is also my registrar. I have an A record setup that points to the IP address of my server with the IP address entered on the domain mapping configuration page.

    I have domain options 1-4 enabled and 5 disabled.

  17. Uncheck 1 and 4 for a test?

  18. mediadisconnect
    Member
    Posted 2 years ago #

    Unchecking 1 and 4 did not solve the problem. :(

  19. Bugger...

    Okay, I can't reproduce this at all. It's got to be something on your setup, where it's not allowing cross-domain loading of images.

    What happens at http://domain.com/wp-includes/ms-files.php?file=/2012/04/IMG_0763.jpg ?

  20. mediadisconnect
    Member
    Posted 2 years ago #

    When I enter that link the picture appears in the browser.

  21. *blink blink* Uh. Okay.

    Can you look at your httpd.conf file? And if so, can you see if you have separate vhost entries for your mapped domain? AND if you do, do they have AllowOverride set to All?

  22. mediadisconnect
    Member
    Posted 2 years ago #

    Ok, I think we are getting a bit closer.

    Bluehost.com does not allow access to the httpd.conf file AND they do not create VirtualHost entries in their httpd.conf files for their parked domains. They did say that AllowOverride is set to All on all of the domains though.

    The support technician did tell me that I can accomplish what I want done in the .htaccess file without needing a Virtual Host entry but he could not tell me how to do it and forwarded me this link:

    http://httpd.apache.org/docs/current/mod/mod_rewrite.html

    Any ideas? BTW, I truly appreciate you helping me with this.

  23. Go back to http://domain.com/files/2012/04/IMG_0763.jpg

    In your site's error log, does it just list a 404, or is there a different error?

    What seems to NOT be happening is that http://domain.com/files/2012/04/IMG_0763.jpg should redirect to http://domain.com/wp-includes/ms-files.php?file=/2012/04/IMG_0763.jpg

    That's what this line in your .htaccess does:
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    I mean, in a horrible pinch we could add this:

    RewriteCond %{HTTP_HOST} ^domain\.com
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    or

    RewriteCond %{HTTP_HOST} ^domain\.com
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) /wp-content/blogs.dir/4/files/$2 [L]

    But that's so weird... (Those would go above the # BEGIN WordPress line.

  24. mediadisconnect
    Member
    Posted 2 years ago #

    neither of those worked.

    I am getting a bunch of these in my error log but I am not sure if I am generating them and not some other website on the hosting computer.

    [Thu Apr 12 15:44:31 2012] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.

  25. The error log should only show your site. That's really bizzare.

    Can you ask Buehost, since they seem to know, WHAT the magic is? I've never had that not work when AllowOverride was All.

  26. mediadisconnect
    Member
    Posted 2 years ago #

    Ok so no go but I think I have found something.

    When I try to upload a file I get this in my error logs:
    File does not exist: /home1/mediadi2/public_html/files/2012, referer: http://newenglandfreeradio.com/wp-admin/upload.php

    When I try to view the file that I just uploaded using the File URL link I get this in my error logs:
    File does not exist: /home1/mediadi2/public_html/files/2012

    When I try to view the file that I just uploaded using the view link I get this in my error logs:
    File does not exist: /home1/mediadi2/public_html/files/2012

    It does not look like the full link is being rewritten for for some reason.

    I will repaste my .htaccess file.

    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

  27. mediadisconnect
    Member
    Posted 2 years ago #

    Do you think it is a mod_rewrite issue or a wordpress issue?

  28. mediadisconnect
    Member
    Posted 2 years ago #

    *** SOLVED *****

    I had a folder off of root named /files where I stored misc files over time. As soon as I renamed the folder to something else everything magically started to work.

    Thank you so much for your time and effort to help me with this problem.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.