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
There is a problem with your
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?
Cookie domain not properly set.
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!
I think you meet problem at
I think you meet problem at symlink too. You should point to ~/mysite.com instead of ~/mysite.com/sites/mysite4.com
You're right, I've edited the original post.
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!
Similar experience but with sub-directory
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.
.
duplicate deleted
By "a similar experience" do
By "a similar experience" do you mean "access denied"
Did you try $cookie_domain="example.com"?
Access denied with subdirectory
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.
.
You said $cookie_domain = 'example.com/ut';
That is wrong. 'example.com/ut' is not a domain.
I know but this is my
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?
You should enter
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?
I changed to: $cookie_domain
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?"
In case it is a problem with
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?
Eureka! That took care of
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.
That depends on the server
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.
Makes sense. I've been
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.
Right, absolutely no problem
Right, absolutely no problem when the URLs are subdomains.
But do try to enable or disable the
RewriteBase /line, just in case it works.I needed to enable rewrite in
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.
Enabling or disabling the
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.
Found a rewrite solution
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.
That was useful.
That was useful.