WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Unable to display images in posts (8 posts)

  1. calisun
    Member
    Posted 3 years ago #

    When I try to insert (Upload) an image into a blog, I just get a Broken image frame.
    I think the issue is:

    After the image is uploaded, I get a link to the pictures as:
    http://My-Domain.com/files/2011/02/image.jpg

    but when I FTP into the server, the image can be found at:
    http://My-Domain.com/wp-content/blogs.dir/2/files/2011/02/image.jpg

    Does anybody know what is going on and how to fix this?
    Thanks in advance.

  2. The images are uploaded to that folder on purpose.

    Your htaccess file rewrites that url to the first one you posted. Since it;s not showing the image, then the htaccess rule is not being read.

  3. Also read this: http://codex.wordpress.org/Create_A_Network#.htaccess_and_Mod_Rewrite

    You may not have correctly edited your .htaccess file.

  4. calisun
    Member
    Posted 3 years ago #

    After a lot of searching, and a lot of comments from the forum here that "Your system is not reading the htaccess file"
    I finally figured out what is wrong.
    I came to realize that the system is reading the htaccess file correctly because I have another social program installed and it is using htaccess to create human legible URL without any problems. So I came to conclusion that the htaccess created by wordpress has issues.
    After some search, I have found a different version of htaccess and it WORKS !!!!!
    The example of that code can be found here:

    Basically, it looks like this:

    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]

    Why is wordpress supplying a code that is not working? Use the one above which works fine.

    WOW... finally after months of frustration I can get to work on my site.

  5. That's the exact same one as we have listed in the codex. (actually it's two bits different, but it's the same as we were using 5 months ago - the only change is the two on the bottom, where @wpmuguru optimized it to run faster)

    http://codex.wordpress.org/Create_A_Network#.htaccess_and_Mod_Rewrite

    That's the same as you got when you upgraded and it said 'change your htaccess to this.'

    You must have missed that step.

  6. calisun
    Member
    Posted 3 years ago #

    No it is not the same, when I go to network settings in my WP installation where it tells me to "Add the following to your .htaccess file" it looks like this:

    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]

    Besides two lines you mentioned that are different, "# uploaded files" code is different and there is also an additional line of code in the middle that is missing from the code provided to me by my WP installation.
    I don't know what it does or how significant it is, but I know when I copy-paste code form my WP install, I have issues.
    But when I copy-paste code provided by @wpmuguru, everything works fine.

  7. THAT is the .htaccess for subDOMAIN installs of WP MultiSite.

    The one you're using is the .htaccess for subFOLDER.

    Did you, perchance, switch between them?

  8. calisun
    Member
    Posted 3 years ago #

    Ok, now I see what is going on, I was thinking that I might have to change htaccess because of what I am doing with my wordpress install, but I have forgotten about doing it.

    No, I have not switched between subDOMAIN and subFOLDER, I am still curently using subDOMAIN, but what I am doing is:

    I am hosting several top level domains on one multisite install without using domain mapping plugin. I accomplish this by:

    Whenever I create a new site in WP, it looks like this:
    newSite.PrimarySite.com
    but what I do after site creation is, I go to site settings and I manually change:

    newSite.PrimarySite.com
    to
    newSite.com

    All top level domains worked fine, except for upload issues and issues with "nice" URL's. (Default permalinks worked OK)
    But now that I use subFOLDER htaccess for my funky subDOMAIN install, everything works fine.

    Only if I have acted on my first thought of using subFOLDER htaccess few months back, I would have saved myself a lot of frustration. But I guess I am starting to forget things in my old age :)

Topic Closed

This topic has been closed to new replies.

About this Topic