• Resolved Paul Barthmaier (pbrocks)

    (@pbarthmaier)


    My multisite installation is an upgraded one from an old WPMU. Things are pretty good, except the media on SubSites. I need a rewrite rule, I guess, for wp-content/blogs.dir/SubSiteID to rewrite as SubSiteName/files.

    My media upload path is wp-content/blogs.dir/SubSiteID/files

    I have these rules already in htaccess:

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

    I have tried commenting out the first one and just using the second. I also have tried adding this to the top of htaccess:

    # Moved Images
    RewriteRule ^wp-content/uploads/(.*)$ https://villageconnector.com/files/$1 [L,R=301]

    What am I missing? Many thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    What’s the actual problem? What error do you get on images?

    Thread Starter Paul Barthmaier (pbrocks)

    (@pbarthmaier)

    The images don’t show, just the placeholder. If I copy the image URL for the blank image, I’ll get something like:

    MainSite/SubSite/files/yyyy/mm/image.name

    for the URL structure, but it’s a broken link. If however, I replace the SubSite with wp-content/blogs.dir/SubSiteID, as in:

    MainSite/wp-content/blogs.dir/SubSiteID/files/yyyy/mm/image.name

    lo and behold, I see the image that I would have hoped to see in my post. So it seems, if we can rewrite ‘wp-content/blogs.dir/SubSite#’ as ‘SubSite’ we’d be in business.

    Thread Starter Paul Barthmaier (pbrocks)

    (@pbarthmaier)

    I realize that in my original post, I may have confused things, but I’d like to confirm that the clarification of ‘files’ being present in both URLs, the broken and the one which renders the image, is correct.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Okay, does this URL work?

    MainSite/SubSite/wp-includes/ms-files.php?file=/yyyy/mm/image.name

    Thread Starter Paul Barthmaier (pbrocks)

    (@pbarthmaier)

    Okay, does this URL work?
    
    MainSite/SubSite/wp-includes/ms-files.php?file=/yyyy/mm/image.name

    Sorry. Should have mentioned that: Does not work.

    To recap – no workie:

    • MainSite/SubSite/files/yyyy/mm/image.name
    • MainSite/SubSite/wp-includes/ms-files.php?file=/yyyy/mm/image.name

    Only

    MainSite/wp-content/blogs.dir/SubSiteID/files/yyyy/mm/image.name

    workie.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Okay, so the problem is that your server can’t handle the rewrite rules ??

    Is AllowOverride set to ALL in your httpd.conf?

    Thread Starter Paul Barthmaier (pbrocks)

    (@pbarthmaier)

    So apparently the AllowOverride is set to ALL, at least according to server admin. I’m wondering if the issue is related to the File Uploads path and htaccess because what I’ve done to temporarily solve the issue is to hardcode the Rewrite rules. Instead of having:

    RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L]

    I have

    RewriteRule ^([_0-9a-zA-Z-]+/)?SubsiteName2/files/(.+) wp-content/blogs.dir/2/files/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?SubsiteName3/files/(.+) wp-content/blogs.dir/3/files/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?SubsiteName4/files/(.+) wp-content/blogs.dir/4/files/$2 [L]
    
    etc

    I know it’s inefficient, but it’s the only thing that works! Fortunately there are only 26 subsites so far.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Yeah, the problem is that your server (not WP) doesn’t handle the complex rewrite rules :/ It’s something your host has to fix.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘htaccess Rewrite rule?’ is closed to new replies.