Hi,
First of all sorry for another Clean URL's post, but i've searched and can't find a solution to my problem anywhere.
I've read all the clean-urls documentation and nothing has helped.
I'm running multiple websites on a dedicated server using apache vhosts every website has it's own domain, and there are about 12 domains in total.
I've just tried to install drupal onto our live server (testing server worked okay, but does have a slightly different setup, as our test server is internal and set up by me, and our dedicated box was set up by the company we lease it from.)
The installation was fine but on trying to enable clean URL's I just get the "The Clean URL Test Failed" error message.
I've enabled rewrite logging for the vhost have noticed something strange that I can't work out in the log
for the purposes of the logs I will refer to my domains as domain1.com and domain2.com
domain1 is the main domain of the server - the one accessed by navigating to it's IP address
domain2 is the domain I'm trying to setup currently.
rewrite log
[12/Dec/2012:08:13:30 +0000] [test.domain2.com/sid#828cd08][rid#84a8918/initial] (3) [perdir /var/www/] add path info postfix: /var/www/admin -> /var/www/admin/config/search/clean-urls/check
[12/Dec/2012:08:13:30 +0000] [test.domain2.com/sid#828cd08][rid#84a8918/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/admin/config/search/clean-urls/check -> admin/config/search/clean-urls/check
[12/Dec/2012:08:13:30 +0000] [test.domain2.com/sid#828cd08][rid#84a8918/initial] (3) [perdir /var/www/] applying pattern '^.*$' to uri 'admin/config/search/clean-urls/check'
[12/Dec/2012:08:13:30 +0000] [test.domain2.com/sid#828cd08][rid#84a8918/initial] (2) [perdir /var/www/] rewrite 'admin/config/search/clean-urls/check' -> 'http://www.domain1.com'
[12/Dec/2012:08:13:30 +0000] [test.domain2.com/sid#828cd08][rid#84a8918/initial] (2) [perdir /var/www/] explicitly forcing redirect with http://www.domain1.com
[12/Dec/2012:08:13:30 +0000] [test.domain2.com/sid#828cd08][rid#84a8918/initial] (1) [perdir /var/www/] escaping http://www.domain1.com for redirect
[12/Dec/2012:08:13:30 +0000] [test.domain2.com/sid#828cd08][rid#84a8918/initial] (1) [perdir /var/www/] redirect to http://www.domain1.com [REDIRECT/301]So for some reason my rewrite is changing the complete domain and therefore failing miserably.
Important bits from Vhosts file
DocumentRoot /home/domain2/test
ServerName test.domain2.com
ServerAlias test.domain-2.com test.domain-2.co.uk test.domain2.co.uk
<IfModule mod_rewrite.c>
RewriteLog "/home/domain2/log/test-rewrite.log"
RewriteLogLevel 3
</IfModule>
<Directory /home/domain2/test>
#httpd dmn entry support BEGIN.
#httpd dmn entry support END.
Options -Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>domain2 .htaccess is the default drupal .htaccess that hasn't had any changes.
any help would be appreciated.
Thanks.
Comments
I don't have the answer but
I don't have the answer but it does look like the syntax in the options line is wrong (using the minus sign for one option). The Apache 2.2 version of the relevant doc is here http://httpd.apache.org/docs/2.2/mod/core.html#options
Digit Professionals
thanks for your reply but I
thanks for your reply but I haven't had any problems with those options in the years that I've been using them (maybe they could be wrong but they've never caused me an issue.),
but anyway those Options are overwritten by the options in the .htaccess file anyway.
Maybe this is relevant?
Maybe this is relevant? http://drupal.org/node/1572984
Digit Professionals
a2enmod
May be this command can help you.
sudo a2enmodThis would enable the required modules. Have 'AllowOverride All' in your config file and finally you need to restart the Apache.
Even I was stuck 2 days back with clean URLs. I did the above step and it worked for me!
Milan Chheda.
"AllowOverrie All" is already
"AllowOverrie All" is already set in my Vhosts file.
rewrite has already been enabled using a2enmod. I can see it attempting to rewrite the URL in the rewrite log, the problem is that it tries to rewrite it to a completely different domain.
you can see from my vhosts file that all my domains are saved in /home/domainname/
but the rewrite sets the per directory to /var/www
but my /var/www directory is empty and not used by any of my websites.
I have been stuck going round in circles with this since Monday. It's causing me a major headache.
I think Apache is installed
I think Apache is installed with default directory as /var/www, which is the reason it's searching in this directory. Try having the domain in this directory. That's a standard and recommended.
Milan Chheda.
But I have a dedicated
But I have a dedicated server, with 12 domains, therefore I can't use only a single folder such as /var/www
hence why my domains are split into user folders.
It is very strange. Did you
It is very strange. Did you consider trying the rewrite base command suggested in the thread I linked above?
Digit Professionals
no matter what I set the
no matter what I set the rewritebase to (as long as it's a valid directory, otherwise the server gives a 500 error)
it always results in the same rewrite happening per directory is /var/www and it rewrites to http://www.domain1.com
it's almost like the rewritebase is overwritten somewhere else?
I would try turning off
I would try turning off multiviews. It is not exactly obvious why it would cause a problem though googling does add a little more to the Drupal documentation advising against it. e.g. old but possibly relevant to Apache 2 http://drupal.org/node/42987
Digit Professionals
Finally!!!
Finally solved it!!!
found this line in /etc/apache2/apache2.conf
Alias /admin "/var/www/admin"and in /var/www there was a single index.html with a meta refresh to domain1.com
So i commented out the line, restarted apache cleared my browsers cache and hey presto the checkbox for enable clean URL's was there
Great! A default index.html
Great! A default index.html may be normal in that location, but if this was a default setup, it may be worth mentioning for future users which Linux distro would have a meta refresh in that file.
Digit Professionals
It's probably worth
It's probably worth clarifying that I commented out the "Alias" line in the apache2.conf.
To stop it redirecting /admin to /var/www
because when Drupal tests for clean URL's it trys to open /admin/config/search/clean-urls
and because my server was redirecting /admin to /var/www the index meta refresh in my index.html was why I was seeing domain1.com
The server is set up so that if someone connects by IP address they go to /var/www and then get redirected which is why /var/www/index.html is set up that way.