0

I have a simple question.

I am trying to create a folder inside the Drupal installation that will not be shared to all the multi-sites.

For example:

www.mydomain.com/xxx

www.anotherdomain.com/xxx

I need this two folders of xxx should go to different path.

How can I achieve that?

I tried to create a new folder in Drupal root folder, but like this all the domains familiar with the same contents.

Thanks for the help.

2 Answers 2

1

To extend @Pierre.Vriens answer , you could then add a rewrite rule to make the urls a bit nicer

assumptions

  1. you've got public files set up
  2. you've got a url 'normalisation' (either symlinks in files directory or 301s) RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]

in your host will take

http://www.example.com/filename.pdf

and rewrite it to

http://www.example.com/sites/www.example.com/files/filename.pdf

what do i mean by url normalisation ? well, if you can get example.com - then you'll get a 404 - as the folder in the sites directory is www.example.com

an easy solution is to use symlinks in the sites directory, or to use 301 redirects

to use symlinks, assume you have

sites/www.example.com

you could then create a symlink to it as follows

ln -s www.example.com example.com

this would create a symbolic link from

sites/example.com

to the www.example.com folder. this means that both www.example.com, and example.com would be found when the rewrite rule runs

3
  • what do you mean by using symlinks as an easy solution can you please show an example for this? Commented Sep 1, 2015 at 14:14
  • sure - I've just added that to the answer
    – Tim Marsh
    Commented Sep 1, 2015 at 15:04
  • Thanks solved the problem . Did it with virtual Dirctory ( Running on iis ) virtual directory was pointing to the sites/mydomain per iis configure. Commented Sep 1, 2015 at 15:31
0

Do not create such folder in the Drupal root folder. But instead create an xxx subfolder in both of these subdirs:

  • sites/mydomain (assuming mydomain is what maps to your www.mydomain.com).
  • sites/anotherdomain (assuming anotherdomain is what maps to your www.anotherdomain.com).

By doing so, the 2 folders sites/mydomain/xxx and sites/anotherdomain/xxx for sure will not be shared between those 2 sites within a multi-site construction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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