WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] Multisite header upload problem - URLs not mapping correctly (15 posts)

  1. mmccauley
    Member
    Posted 1 year ago #

    Hi everyone, I have a wordpress network that recently had a problem out of the blue... some of my users were suddenly getting the "error establishing database connection" message... my host's tech support fixed it, but since then users have been unable to upload header images on themes that support that function.

    I can tell why the headers aren't showing up, but I don't know how to fix it. The images are getting uploaded, but it seems the subdomains aren't mapping correctly to their respective blogs.dir folders. For example:

    After uploading a header to one of my user's blogs, the page source shows this:
    user.mysite.com/files/2012/07/header.jpg

    In my network admin area, this blog's Upload Path under Sites > Settings is:
    wp-content/blogs.dir/42/files

    In FTP, I go to the following URL and the image is, indeed there:
    mysite.com/wp-content/blogs.dir/42/files/2012/07/header.jpg

    Can someone please tell me what's going on here and how to fix it?

    Many thanks,
    Michael

  2. Those are all correct. Read http://codex.wordpress.org/Multisite_Network_Administration#Uploaded_File_Path

    What's in your .htaccess

  3. mmccauley
    Member
    Posted 1 year ago #

    Thanks Ipstenu... I have an .htaccess.bkp file which I assume is what it was before my tech support had to fix the site, and it looks like this:

    Options +MultiViews
    # BEGIN WordPress
    php_flag allow_url_fopen on
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    #RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    #RewriteCond %{REQUEST_FILENAME} -f [OR]
    #RewriteCond %{REQUEST_FILENAME} -d
    #RewriteRule ^ - [L]
    #RewriteRule . index.php [L]
    #</IfModule>
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress# END WordPress

    My .htaccess after the fix looked like this:

    # BEGIN Better WP Security
    Order allow,deny
    Allow from all
    Deny from  XX.XXX.XX.157 XX.XXX.XXX.89
    
    # END Better WP Security
    
    #Options +MultiViews
    # BEGIN WordPress
    php_flag allow_url_fopen on
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    #RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    </IfModule>
    
    # END WordPress

    I took the last part from the .bkp file and added it to my current htaccess so the whole thing looks like this:

    # BEGIN Better WP Security
    Order allow,deny
    Allow from all
    Deny from  XX.XXX.XX.157 XX.XXX.XXX.89
    
    # END Better WP Security
    
    #Options +MultiViews
    # BEGIN WordPress
    php_flag allow_url_fopen on
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    #RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    #RewriteCond %{REQUEST_FILENAME} -f [OR]
    #RewriteCond %{REQUEST_FILENAME} -d
    #RewriteRule ^ - [L]
    #RewriteRule . index.php [L]
    #</IfModule>
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress# END WordPress

    I also deactivated the Better WP Security plugin, but I still can't upload a new header! Hmm.

  4. Let's strip it to it's roots, shall we?

    Do this:

    Options +MultiViews
    php_flag allow_url_fopen on

    Now. Read this and get the WordPress section for either subdomain or subfolder - http://codex.wordpress.org/Multisite_Network_Administration#.htaccess_and_Mod_Rewrite

    I don't know which you have, but it you have user.domain.com it's subdomain, and domain.com/user is subfolder :)

  5. mmccauley
    Member
    Posted 1 year ago #

    Hi Ipstenu, thanks a lot! But now my posts and pages won't load... they just display the homepage.

    Posts and pages will load if I change permalinks to the default setting, but if I try using day/name, month/name, or any of the other settings the problem returns.

    This problem seems to be affecting only my main blog, not the subdomain blogs.

    Any ideas? Thanks again.

  6. Did you do the second half of what I said? To get the correct .htaccess WordPress code for your site?

    This bit:

    Now. Read this and get the WordPress section for either subdomain or subfolder - http://codex.wordpress.org/Multisite_Network_Administration#.htaccess_and_Mod_Rewrite

    I don't know which you have, but it you have user.domain.com it's subdomain, and domain.com/user is subfolder :)

  7. mmccauley
    Member
    Posted 1 year ago #

    Yes, I copied the htaccess from that page. This is what it looks like now:

    Options +MultiViews
    php_flag allow_url_fopen on
    
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress
  8. And you're saying that you can use pretty permalinks on all the sub-sites?

  9. mmccauley
    Member
    Posted 1 year ago #

    No, the problem is that I *can't* use permalinks. The only setting that works is default. If I switch to anything else, then all pages and posts just display the homepage!

    I know the easiest "solution" would be to use the default link structure, but I'd really like to avoid that if possible.

  10. mmccauley
    Member
    Posted 1 year ago #

    Crap sorry I misread your reply... yes, on subdomains the permalinks work correctly.

  11. S'okay :D

    Have you turned off all the plugins on your main site? If that's the only one having the problem, then it's got to be something you did there.

  12. zerkaloolakrez
    Member
    Posted 1 year ago #

    i have subfolders-type multisite and heve exetely same problem like this man with subdomains variant.

    This is my .htaccess:

    # 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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress

    Upload Path URL: http://mysite.com/wp-content/blogs.dir/3/files
    Upload Path: wp-content/blogs.dir/3/files
    Fileupload Url: http://mysite.com/site2/files/

  13. zerkaloolakrez
    Member
    Posted 1 year ago #

    Maybe somebody mature can help me with this thing. Thank you.

  14. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    As per the Forum Welcome, please post your own topic. Your problem - despite any similarity in symptoms - is likely to be completely different.

  15. "mature"? I'm not sure how to take that...

    Anyway, please make your own topic. Closing this.

Topic Closed

This topic has been closed to new replies.

About this Topic