Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to migrate from multiple subdomain blogs to WP multisite. The one stumbling block is that I'm pretty sure the static files and directories on my subdomains will not be found; each of my blogs has its own set of static files (downloads, mp3 archives, scripts, etc.). What would be a way to maintain these?

Will the following work? I assume it will redirect anything with a . in it, no?

RewriteCond %{HTTP_HOST} ^sub\.domain\.org$
RewriteCond %{REQUEST_URI} \.
RewriteRule ^(.*)$ sub/$1 [R=301,L]
share|improve this question
add comment

2 Answers 2

The standard WP RewriteRules ignore files and directories that "exist". Example:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

This the rewrite rule set for a WP install in the "root" of a site. Notice these two lines in particular:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

These set the conditions that the file or directory being referenced must not exist. Thus, only files/directories that Apache doesn't find get rewritten to WordPress's index.php file.

So if Apache finds the file and can serve it directly, then it will, and WordPress will not get involved. So static links should remain as they are as long as the files are in the same place as before.

share|improve this answer
    
Thanks, I realized that; the problem is that I need to redirect files on the subdomains to the old subdomain directories, like /var/www/sub1/file.mp3 if the request is http://sub1.mysite.com/file.mp3. Since the subdomain no longer points to the sub1 directory, it's a little tricky. Anyway, I think I have it working now with custom redirects. –  yuttadhammo Feb 7 '12 at 7:00
add comment

what I've done in the past is from the subdomain, I've exported all content. Then in the WP multisite, I've imported invluding all downloaded attachments. This seemed to have move over all my images and the like .

share|improve this answer
    
Thanks, but I'm talking about gigabytes of mp3s, etc. I don't want to import them into wordpress, just have them accessible via their original url before switching to Network Install. –  yuttadhammo Jun 20 '11 at 10:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.