Moving and aliasing sites has the problem that the links will still be generated with the one sites directory for the site.

This will also handle the issue of external people directly linking to files in the moved site.

We already leave a virtual host file in place for redirects, this could just be an extension of that.

Comments

anarcat’s picture

Did anyone ever consider adding aliases for the /files URL to the "right" directory in the vhost? That would fix this issue in a cleaner way, provide cleaner and shorter urls...

anarcat’s picture

Issue tags: +aegir-0.4

tagging for 0.4

anarcat’s picture

I have added a redirection like this in the platform configuration (our equivalent of .htaccess):

  # allow files to be accessed without /sites/fqdn/
  RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]

That doesn't resolve *all* the issues, but at least now the WYSIWYG modules can refer to /files/ instead of sites/fqdn/files and that will work reliably across clones and site renames. That way we don't need a redirect.

We have had discussions about editing the node body and teaser to fix the urls, but we are deciding against it right now, for two reasons. 1) the node table can be immensely bigger than the files table and 2) we risk destroying unrelated data (how do you tell someone that's talking about his sites/example.com/files folder from someone that's actually linking to it?).

So bottomline: the body/teaser/whatever should now refer to /files/ instead of /sites/fqdn/files/. I consider it's the responsability of the drupal core and the various contrib modules to do that, not ours (even though we should lobby to get all that into core, actually). See #580058: allow files to be referenced only with /files/ (instead of /sites/fqdn/files) for further work on that. Also note that Drupal 7's [http://api.drupal.org/api/function/hook_file_url_alter/7 hook_file_url_alter] may solve the issue for us, but we would need a custom module.

anarcat’s picture

Status: Active » Closed (won't fix)

  • Commit 835bcbe on debian, dev-dns, dev-envobject, dev-koumbit, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, dev-newhooks, dev-nginx, dev-platform_management, dev-ports, dev-purgebackup, dev-restore, dev-services, dev-simplerinstaller, dev-site_rename, dev-ssl, dev_716166_apache_conf, dev_dns, dev_server_verify, prod-koumbit, ssl, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x authored by anarcat:
    #275022 - add a /files -> /sites/fqdn/files rewrite rules so that files...

  • anarcat authored 835bcbe on dev-1995506
    #275022 - add a /files -> /sites/fqdn/files rewrite rules so that files...

  • anarcat authored 835bcbe on 7.x-3.x-1966886-context-to-entity
    #275022 - add a /files -> /sites/fqdn/files rewrite rules so that files...

  • anarcat authored 835bcbe on 6.x-2.x-1995506-profile-option
    #275022 - add a /files -> /sites/fqdn/files rewrite rules so that files...