Posted by no2e on December 3, 2008 at 3:23am
Introduction
I just started my first multisite setup (on a shared hosting account).
sites/default
→ example.com/drupalsites/foobar.example.com
→ foobar.example.com
The problem
Clean URLs work great for example.com/drupal.
But not for foobar.example.com; it says:
Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information.
The solution?
This book page exactly describes my problem. But I don't understand the suggested solution. Where and in what way do I have to edit the .htaccess
?
In many other threads (and also in the comment of the linked page) it's said, that you have to edit the http.conf
- but I'm not allowed to edit it at my shared hosting, I think.
Possible?
- I want all my additional sites to work with Clean URLs.
- And all sites shall redirect the version with www. to the version without it. So www.foobar.example.com shall become foobar.example.com
Comments
Update (1)
It works ...
After butchering my
.htaccess
file, I started with the default one again, and - what shall I say - it works. Clean URLs work in my default and in my additional site.... partly
But I had to deactivate the redirection from www. to no-www.
So, could someone help me?
What do I have to change, so that every site shall use only the version without the www-prefix? And where exactly do I have to place it in my
.htaccess
?If it would ease things up: it would suffice, that only all additional sites use the URL structure withouth the www-subdomain. I can live with the default site using it, because it won't be public at all.
Additional questions (unrelated)
Got some questions wich are no own thread worth, I think.
Default install in subfolder, additonal site in root?
Is it possible, to install Drupal in example.com/drupal and to create a multisite for example.com?
So the sites structure would look like:
sites/default
→ example.com/drupalsites/example.com
→ example.comOr would that break something?
/EDIT: hum, never mind. I think it's not possible, because I can't tell example.com, that it shall look in example.com/drupal (which is possible for me only with domains and subdomains, I'm afraid).
$base_url
I shall edit in eachs multisite settings.php the
$base_url
, correct? So in the settings.php inside of/sites/foobar.example.com
I set it to:$base_url = 'http://foobar.example.com'; // NO trailing slash!
Should I edit it in the settings.php of
/sites/default
, too?bump
No idea? :/
How did you implement the www to non-www (or vice versa) redirects for your multisites?
Update (2)
Okay, with this code (by open-keywords), www to non-www redirection works for my multisites:
# non empty HTTP_HOST in the request
RewriteCond %{HTTP_HOST} !^$ [NC]
# the hostname does start with 'www.'
RewriteCond %{HTTP_HOST} ^www. [NC]
# let's extract the hostname without 'www.' and save it to %1
RewriteCond %{HTTP_HOST} ^www.(.)$ [NC]
# let's redirect to the extracted hostname, $1 saves the URL
RewriteRule ^(.)$ "http://%1/$1" [L,R=301]
... but not for my default/main site. The main site redirects from http://example.org/drupal (where Drupal is installed) to http://example.org/ (where no Drupal is installed).
... help? :|
Still need help
Can't I express my problem clearly? (English is not my native language, as you might have guessed ;)
Please ask, if something is unclear. I need help.
Created another topic.
Hmm
It is strage what u said.
In attachement i give u my settings.php on one my multi-ste.
There is enything special there... I think it is problem with configuration on your server. I suggest to ask server admin to check configuration of your domain. I'll try to help u.
I have 17 sites in my multi-site configuration and i hadn't problem with that. But we'll try.
Attachement missing?
Thanks for your answer!
Can't find your attachement. Did you forget uploading it?
Am I getting you right: you also use www. to non-www. redirection/rewrite? (because that's actually my problem) Wouldn't I need a
.htaccess
example?I bet it's just me doing some stupid mistakes - don't know any details about
.htaccess
and stuff like that.Okey
Lets start. (examples in attachements) settings and .htaccess
All are default. Nothing special.
My configuration sample:
page.u-c.pl (main site)
-sites
- default (files to page.u-c.pl)
-settings.php
-chorwiwat.pl
-files
-modules
-settings.php
etc.
Hmm, you don't use www. to
Hmm, you don't use www. to non-www redirection, do you? Because, that is actually my problem.
base_url
Try to comment the base_url line in settings.php
In general: Should I use the
In general:
Should I use the base_url setting in all of my settings.php, or in the default one only?
And if I should use it in all settings.php - how exactly should the setting look like for the multisite sites? (the URL where Drupal is installed, or the domain of the multisite?)
Okay, I'll comment the base_url setting for testing now.
/edit: didn't change anything. But the problem might be, that I don't know, what the correct way to solve my problem would be. So, I don't know which htaccess-settings should work.
.htaccess
.htaccess shlould be default, and it should work with it. But In my case i have drupal site in main site directory. You have in /drupal directory and you shuld for settings write:
$base_url = 'http://www.example.com/drupal';
and if you tell me that when www is include there is problem with clean urls than you should edit the .htaccess and turn url check on to force non-www.
tell me if it is good