Files not redirecting with Domain Mapping?

Quick question...

Domain mapping seems to be working great for the site, but all files are gone as if they are missing.

It seems to be a simple redirect that is missing or incorrect somehow, but I don't see where. htaccess seems to be correct.

http://name.site.tld is now http://domain.tld

images, etc. look like
http://domain.tld/wp-content/blogs.dir/5/etc.......

they worked on subdomain with files at
http://name.site.tld/wp-content/blogs.dir/5/etc.......

But once http://domain.tld is in place all files (even icons in the admin menu) are missing.

Any ideas?

Thanks!

Marty

  • Marty Thornley
    • Site Builder, Child of Zeus

    Okay - figured it out. Typical slap your forehead kind of thing...

    I had added a line to htaccess to disable hotlinking, which of course would see the new domain as an outside domain and make images not show up.

    I removed it for now, but any idea if there could be a way to disable hotlinking while still enabling people to use their own domain?

  • Mason
    • DEV MAN’s Sidekick

    Hey Marty,

    Yeah, editing the .htaccess to disable hotlinking would definitely disrupt things. Glad you found the culprit!

    That being said, you've still got a problem. What about password-protecting your image folders? Then users could not directly download the files. Honestly, I'm not sure otherwise. Maybe somebody else from the community has a suggestion?

  • Aaron
    • CTO

    I don't know of anyway to prevent hotlinking via htaccess with domain mapping. Those protections work by checking the referrer, so you would have to have an uptodate list of all mapped domains.

    If files link the normal way through the /files/ dir they are handled by php in the ms-files.php script, which could be modded by a plugin to stop hotlinking.

  • Marty Thornley
    • Site Builder, Child of Zeus

    My initial thought was exactly that @joseph. add a section to htaccess that could be written to with mapped domains. Should be easy enough to keep current. I just haven't written to htaccess before and am reluctant to take it on just this second. One day...

    I was using some ideas from:
    http://perishablepress.com/press/2007/11/21/creating-the-ultimate-htaccess-anti-hotlinking-strategy/

    Mostly the boiled down version:
    # ultimate hotlink protection
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png)$ [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain\. [NC]
    RewriteRule \.(gif|jpe?g?|png)$ - [F,NC,L]
    </ifModule>

    This works fine for all subdomains - so anyone not using domain mapping could try the above.

    The idea of using the IP address seemed promising so I added:

    # ultimate hotlink protection
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png)$ [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain\. [NC]
    RewriteCond %{HTTP_REFERER} !^http://123.123.123.123.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://123.123.123.123:80.*$ [NC]
    RewriteRule \.(gif|jpe?g?|png)$ - [F,NC,L]
    </ifModule>

    That didn't work for mapped domains, so I tried several combos using the IP address based on a bunch of different sites but could not get any to work.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.