WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can I create an 'images' folder for a subdomain multisite? (5 posts)

  1. mydog8it
    Member
    Posted 1 year ago #

    I'm moving a site that was on its own install to a subdomain multisite install with domain mapping. Problem is, the site used to be in html and all of the old images are in a mydomain.com/images folder, and the posts link to them there.

    I've tried adding an images folder here: /wp-content/blogs.dir/2/images

    and here: /wp-content/blogs.dir/2/files/images

    but when I go to mydomain.com/images, it doesn't exist. Is it possible to do this with a multisite install? Where do I put the folder?

  2. Keep them in /wp-content/blogs.dir/2/images and do this:

    RewriteRule ^images/(.*)$ /wp-content/blogs.dir/2/images/$1 [L,R=301]

    Put that above your WordPress htaccess rules :D

  3. mydog8it
    Member
    Posted 1 year ago #

    Thanks!! yay. This worked great.

    But...I also have an images folder in my main site, and it's redirecting those into the other site's folder now. I'm not super familiar with htaccess files. Can I just change it to the specific domain, like this?

    RewriteRule ^mydomain.com/images/(.*)$ /wp-content/blogs.dir/2/images/$1 [L,R=301]

    or do I need to get rid of the ^

    RewriteRule mydomain.com/images/(.*)$ /wp-content/blogs.dir/2/images/$1 [L,R=301]

    I don't want to try random things and blow up the internet.

  4. Close!

    # MyDomain Images
    RewriteCond %{HTTP_HOST} ^mydomain\.com
    RewriteRule ^images/(.*)$ /wp-content/blogs.dir/2/images/$1 [L,R=301]

    The RrewriteCond is only good for one line, so if you want to also redirect mydomain.com/rainbows to mydomain.com/wp-content/blogs.dir/2/rainbows it works like this:

    # MyDomain Redirects
    RewriteCond %{HTTP_HOST} ^mydomain\.com
    RewriteRule ^images/(.*)$ /wp-content/blogs.dir/2/images/$1 [L,R=301]
    RewriteCond %{HTTP_HOST} ^mydomain\.com
    RewriteRule ^rainbows/(.*)$ /wp-content/blogs.dir/2/rainbows/$1 [L,R=301]
  5. mydog8it
    Member
    Posted 1 year ago #

    Works perfectly! Thank you so much. You saved me days of work. :)

Topic Closed

This topic has been closed to new replies.

About this Topic