I've installed drupal at mysite.com.
I have several multisite installs, thus:
mysite.com/sites/mysite2.com
mysite.com/sites/mysite3.com
etc.

I want to install mysite4.com this way:
Copy the sql data from mysite3.com.
mysqldump --opt -hHOST -uUSER -pPASS site3_drupal >sql_from_site3.sql

Copy the files from mysite3.com

cd ~/mysite.com/sites
cp -r ./mysite3.com/* ./mysite4.com (or whatever - this may not be the correct syntax for copying all files...)

Edit settings.php in mysite4.com to use site4_drupal database on host

cd ~/mysite.com/sites/mysite4.com
chmod 644 settings.php
nano -w settings.php
...

EDITED: Create the symbolic link for the domain

cd ~/
ln -s ~/mysite.com mysite4.com 

Create the database site4_drupal on my host.
Upload the data to my database:
mysql -uUSER -pPASS -hHOST site4_drupal < sql_from_site3.sql

When I bring up mysite4.com in a browser, I can see the site. It looks exactly like mysite3.com and I can access the login form, but everyone including admin always gets 'access denied'.

How can I fix this?

Comments

cog.rusty’s picture

There is a problem with your symlink command (it points to somewhere where there is no index.php), but I guess you got it right since your site is accessible.

I got an "access denied to everyone" problem once, and the cause was that I had used mysql:// instead of mysqli:// in the $db_url while I had installed only the mysqli extension.

If the problem is not that, there are a couple of things to take a look at:
- add an override $conf['site_name']='This is Site4'; in the new settings.php to make sure that you are looking at the new site.
- check the cookies in your browser: are you getting a cookie for site4.com?

gr33nman’s picture

Thanks cog.rusty, that's got it.

This variable in settings.php was set for mysite3.com.
cookie_domain = 'www.mysite3.com';

I changed the variable to
$cookie_domain = 'www.mysite4.com';
and now everything works as ordered.

I knew it had to be something simple.

Again, cheers!

Nguyen DO’s picture

I think you meet problem at symlink too. You should point to ~/mysite.com instead of ~/mysite.com/sites/mysite4.com

gr33nman’s picture

nguyendhex,

I'd done it correctly in apache. I just wrote it wrong in my post. Thanks for pointing that out. I've edited the line in question in the post.
It turned out to be the cookie_domain variable (see other post in thread.)

Thanks!

toppen56’s picture

I'm having a similar experience. However, I wanted my site in a sub-directory -- example.com/ut

Following the instructions at: http://drupal.org/getting-started/6/install/multi-site, I set up as follows:

1. In the sites folder, there is a site: example.com.ut and I asked my host to set up a symbolic link in the root directory as follows:

ln -s . ut

The install worked fine but I'm having the experience describe above.

I double-checked and my settings.php file has the cookie domains commented out. I'm confused what to do at this point.

cog.rusty’s picture

duplicate deleted

cog.rusty’s picture

By "a similar experience" do you mean "access denied"

Did you try $cookie_domain="example.com"?

toppen56’s picture

Yes, I receive "access denied" whatever I try to access. The access denied page looks like the root site. My login page on the subdirectory site however looks different than the login page on the root site

I made the following change in settings.php in the subdirectory site:

$cookie_domain = 'example.com/ut';

When that didn't work, I also attempted to add the base url:

$base_url = 'http://www.accessecure.net/ut'; // NO trailing slash!

Neither of these made a difference.

cog.rusty’s picture

You said $cookie_domain = 'example.com/ut';
That is wrong. 'example.com/ut' is not a domain.

toppen56’s picture

I know but this is my challenge.

I'm using a subdirectory and the same domain. I understood you could do this with a multisite setup so I have example.com and example.com/ut/

Adding $cookie_domain = 'www.example.com';

doesn't help.

What do I enter or can I not do this?

cog.rusty’s picture

You should enter 'example.com' for all sites which use this domain, and nothing else. It is the only right thing. If this doesn't solve the problem, then the problem is something else.

You said "My login page on the subdirectory site however looks different than the login page on the root site." Can you express this with exact example URLs, to understand better what you see?

toppen56’s picture

Thanks for trying to work through this with me.

Main site: http://www.example.com
Sub-directory site: http://www.example.com/ut

The login/home pages for the two sites appear with different themes and content. However, when I go to the: http://www.example.com/ut site and login, I am sent to the page: http://accessecure.net/ut/node?destination=node This page looks exactly like the http://www.example.com home/login page and contains the error message that says:"Sorry, unrecognized username or password. Have you forgotten your password?"

cog.rusty’s picture

In case it is a problem with apache rewrites, disable clean URLs in the "ut" site by adding a $conf['clean_url'] = 0; line at the end of its settings.php file. Then try to login. Any difference?

Is your Drupal login user/password different between the two sites?

toppen56’s picture

Eureka! That took care of it. Thanks so much.

So will I not be able to use clean urls?

The login user/password was different between the two sites.

cog.rusty’s picture

That depends on the server configuration. Sometimes enabling or disabling the RewriteBase / line in .htaccess solves the problem. It doesn't work always for subdirectory sites, but sometimes does.

The problem is that a multisite has only one .htaccess, and I don't know any way to set alternative RewriteBases for different sites in the same .htacces. It can only be done for sure in apache's vhost files, where I guess you don't have access.

toppen56’s picture

Makes sense. I've been testing out the multisites concept with this url and hosting plan.

So my understanding is that if I use ut.example.com rather than example.com/ut and have a server where I can set up vhosts, we could have a common codebase and have multiple sites with clean urls.

cog.rusty’s picture

Right, absolutely no problem when the URLs are subdomains.

But do try to enable or disable the RewriteBase / line, just in case it works.

toppen56’s picture

I needed to enable rewrite in order to get the clean urls on the root site. So if I disable it, I won't have any clean urls so that doesn't seem to be the solution.

Thanks so much for taking the time to help me out and better understand how it works.

cog.rusty’s picture

Enabling or disabling the RewriteBase does not necessarily disable rewrites. The RewriteBase is only needed in servers where the URL path of the site is an apache alias and does not agree with the physical path of the site. So, it's worth a try.

toppen56’s picture

I found a way I can still have clean urls in my sub-directory site. It is described on this page:

http://drupal.org/node/15365

Scroll down to "Server configuration for Clean URLs on a shared server, with .htaccess" and then look for the sub-heading "Multi-site" I tried it out and it worked for me.

cog.rusty’s picture

That was useful.