This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Drupal, multiple domains, subdirectories
Author
Message |
grabegrabe
Newbie


Joined: 28 July 2011
Posts: 7
Posted: 28 July 2011 at 4:01pm

Windows 2003, IIS 6, Drupal 6.11, ISAPA_Rewrite 2 (full)

Primary site in: /wwwroot
Second site in: /wwwroot/second_site

I want to use Drupal's clean URLs on each site. You have some lovely instructions for
ISAPI_Rewrite3, but not for ISAPI_Rewrite2, so I've been floundering through various
help files.

The primary site works just fine, but no combination of things I've tried gets the
second site to work, though I have managed to break the primary site more than once.
Along the way I've discovered that:

1. ISAPI_Rewrite2 seems to pay no attention to the httpd.ini file in
wwwroot/second_site, so modifications there are worthless.
2. Various conditional base changes have no effect on the secondary site, but do have
some effect on the primary site, usually breaking it.
3. Drupal continually reports that URL rewriting is not available on the secondary
site. Manually overriding the setting results in errors.

So I've eventually come to my current set of rules that don't break the primary site,
but also don't work for the second site. Lines are lettered for easy reference later:

A: RewriteRule /(.*)\?(.*) /index.php\?q=$1&$2 [I,L]
B: RewriteRule (^/second_site/.*) /second_site/index.php\?q=$1 [I,L]
C: RewriteCond %URL !^/second_site/(.*)$
D: RewriteRule ^(.*)$ index.php\?q=$1 [I,L]

My understanding here is that A takes any URL with a ? and passes it as a query to
drupal. Line B should match a URL in the second site and convert it for drupal, yes?
Lines C&D, combined, take any non-second_site URL and convert it for drupal.

Questions:

If I comment out C, then the primary site breaks. Why?
What miraculous combination of these things do I need to so that ISAPI_Rewrite can
actually rewrite the directories on second_site?
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 29 July 2011 at 4:27am

"1. ISAPI_Rewrite2 seems to pay no attention to the httpd.ini file in wwwroot/second_site, so modifications there are worthless."
- true. ISAPI_Rewrite 2 only cares about configs in the root of the site (and ISAPI_Rewrite installation folder).

As for your ruleset, let's try to fix it the following way:

RewriteRule /(?!second_site.*)(.*)\?(.*) /index.php\?q=$1&$2 [I,L]
RewriteRule (/second_site/.*) /second_site/index.php\?q=$1 [I,L]
RewriteRule /(?!second_site.*)([^?]*)$ /index.php\?q=$1 [I,L]

__________________
Regards,
Anton
Back to Top
 
grabegrabe
Newbie


Joined: 28 July 2011
Posts: 7
Posted: 29 July 2011 at 7:05am

Sorry to report: same behavior.

On second_site, Drupal reports "Your system configuration
does not currently support this feature" when looking at
clean URLs. Manually overriding results in 404 errors.

The good news is that this rule set did not break the
primary site, so I'm no worse off than before.
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 29 July 2011 at 7:46am

Could you please show me the exact request you make for testing.
I'll try to figure it out.

__________________
Regards,
Anton
Back to Top
 
grabegrabe
Newbie


Joined: 28 July 2011
Posts: 7
Posted: 29 July 2011 at 7:58am

Primary site is www.ambs.edu. Located at web root.
Secondary site is www.ambs.edu/library2011. Located in
subdir of web root.

I can visit www.ambs.edu/about and the clean URL works. I
can also visit www.ambs.edu/index.php?=about
successfully. This is as it should be for drupal with
clean URLs. And when I go to the clean URL administration
page in drupal, I'm told that the server can handle clean
URLs. If httpd.ini is misconfigured for the main site,
then drupal recognizes that clean URLs are not available.

I can visit www.ambs.edu/library2011/index.php?=about-
the-library successfully. When I go to the clean URL
administration page in drupal, I'm told that the server
cannot handle clean URLs. When I override this and try
them anyway, I get a 404 error when I try to visit
www.ambs.edu/library2011/about-the-library (but the
index.php?=about-the-library still works).

Is this the information you're requesting?
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 29 July 2011 at 8:41am

Let's try to modify your rules once again:

RewriteRule /(?!second_site.*)(.*)\?(.*) /index.php\?q=$1&$2 [I,L]
RewriteRule /second_site/(.*) /second_site/index.php\?q=$1 [I,L]
RewriteRule /(?!second_site.*)([^?]*)$ /index.php\?q=$1 [I,L]

__________________
Regards,
Anton
Back to Top
 
grabegrabe
Newbie


Joined: 28 July 2011
Posts: 7
Posted: 29 July 2011 at 10:01am

Same behavior: works for /second_site/index.php?=about-the-
library; does not work for /second_site/about-the-library,
and drupal does not see that the site supports clean URLs.

I'm trying to prepare a clean copy of my config to send so
you can see exactly what's there and what's not. Can I do
this privately?
Back to Top
 
grabegrabe
Newbie


Joined: 28 July 2011
Posts: 7
Posted: 29 July 2011 at 10:36am

Ok, here are my actual Drupal-related rules, working on
the primary site:

RewriteRule (.*\.htc) $1 [I,L]
RewriteRule (.*\.ico) $1 [I,L]
RewriteRule (.*\.css) $1 [I,L]
RewriteRule (.*\.js) $1 [I,L]

RewriteRule (/cron.php) $0 [I,L]
RewriteRule (/update.php.*) $0 [I,L]
RewriteRule (/xmlrpc.php.*) $0 [I,L]

RewriteRule (/themes/.*) $0 [I,L]
RewriteRule (/misc/.*) $0 [I,L]
RewriteRule (/modules/.*) $0 [I,L]
RewriteRule (/files/.*) $0 [I,L]
RewriteRule (/sites/.*) $0 [I,L]

RewriteRule /index.php.* $0 [I,L]
RewriteRule /(.*)\?(.*) /index.php\?q=$1&$2 [I,L]
RewriteRule /(.*) /index.php\?q=$1 [I,L]

I tried duplicating these rules and enclosing the first
set with UriMatchPrefix /library2011 and UriMatchFormat
/library2011, but without success - same behavior as
described before.
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 01 August 2011 at 4:27am

Let's try to combine your rules the following way:

RewriteRule (.*\.(?:htc|ico|css|js)) $1 [I,L]

RewriteRule (/(?:cron|update|xmlrpc)\.php) $0 [I,L]

RewriteRule (/(?:themes|misc|modules|files|sites)/.*) $0 [I,L]

RewriteRule /library2011/(.*) /second_site/index.php\?q=$1 [I,L]

RewriteRule /index.php.* $0 [I,L]
RewriteRule /(.*)\?(.*) /index.php\?q=$1&$2 [I,L]
RewriteRule /(.*) /index.php\?q=$1 [I,L]

__________________
Regards,
Anton
Back to Top
 
grabegrabe
Newbie


Joined: 28 July 2011
Posts: 7
Posted: 08 August 2011 at 3:57pm

No joy. The new rules work just fine on the primary site,
but they don't work on the subdomain.

I though perhaps I could do something like this for the
subdomain (thinking perhaps this could work as a
RewriteBase equivalent):

RewriteRule (/library2011.*) $0
RewriteRule index.php.* $0 [I,L]
RewriteRule (.*)\?(.*) index.php\?q=$1&$2 [I,L]
RewriteRule (.*) index.php\?=$1 [I,L]

Then repeat the last three rules for the primary site.
That breaks the main site. So the configuring and testing
continues ...
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 09 August 2011 at 5:49am

Could you please specify the exact request you doing and the resulting URL you are expecting to get.

__________________
Regards,
Anton
Back to Top
 
grabegrabe
Newbie


Joined: 28 July 2011
Posts: 7
Posted: 09 August 2011 at 10:49am

I took a fresh look today and solved (I think) the problem.

The issue was an earlier rule for our existing non-drupal library site.
That rule was:

RewriteRule (/library.*) $0 [I,L]

Since "/library2011" also matches that pattern the library2011 rules were
not running. I emended the earlier rule to:

RewriteRule /library/(.*) /library/$1 [I,L]

Now the existing library web pages still work, and the new drupal subweb
actually runs some rules. Adding another rule so it could find its theme
directory made the whole site work.

The current, not-broken, honest to goodness complete rules are (lines
labeled for easy reference):

A. RepeatLimit 32
B. RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
C. RewriteRule .*\.isrwhlp / [F,I,O]

D. RewriteRule /library$ $0 [I,L]
E. RewriteRule /library/(.*) /library/$1 [I,L]

F. RewriteRule (/ljohns.*) $0 [I,L]
G. RewriteRule (/iTunesU.*) $0 [I,L]
H. RewriteRule (/boardinfo.*) $0 [I,L]
I. RewriteRule (/sophosathome.*) $0 [I,L]
J. RewriteRule (/cgi-bin.*) $0 [I,L]
K. RewriteRule (/robots.txt) $0 [I,L]
L. RewriteRule /!explore /explore [I]
M. RewriteRule (/_vti_.*) $0 [I,L]

N. RewriteRule (.*\.(?:htc|ico|css|js)) $1 [I,L]
O. RewriteRule (/(?:cron|update|xmlrpc)\.php) $0 [I,L]
P. RewriteRule (/(?:themes|misc|modules|files|sites).*) $0 [I,L]

Q. RewriteRule
(/library2011/(?:themes|libraries|modules|files|tmp|sites|misc).*) $0 [I,L]
R. RewriteRule /library2011/index.php.* $0 [I,L]
S. RewriteRule /library2011/(.*)\?(.*) /library2011/index.php\?q=$1&$2
[I,L]
T. RewriteRule /library2011/(.*) /library2011/index.php\?q=$1 [I,L]

U. RewriteRule /index.php.* $0 [I,L]
V. RewriteRule /(.*)\?(.*) /index.php\?q=$1&$2 [I,L]
W. RewriteRule /(.*) /index.php\?q=$1 [I,L]

Rules A-C are Helicon defaults.
Rules D-E are for the old library website to keep working (for a while).
Rules F-M pass through various non-drupal directories/subwebs.
Rules N-P pass through critical primary directories/extensions
Rules Q-T make the new library subweb work with drupal
Rules U-W make the primary site work with drupal

My guess is that I could combine rules P-Q into a single rule like:

RewriteRule ((?:/|/library2011/)
(?:themes|misc|modules|files|sites|libraries|tmp).*) $0 [I,L]

My further guess is that trying this may break things further, so I have
yet to decide whether it's worth doing.

My still further guess is that these rules could be reorganized a bit to
make them more efficient. Also something I have to decide whether it's
worth doing.

Thanks for all your help. This turned into much more of a project than I
expected.

The results can be seen at:

http://www.ambs.edu
http://www.ambs.edu/library2011 (soon to be http://www.ambs.edu/library)
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 August 2011 at 2:23am

I'll comment on your guesses:

"Since "/library2011" also matches that pattern the library2011 rules were not running."
- that was definitely the reason!

"My guess is that I could combine rules P-Q into a single rule"
- I've combined them for you in line Q.

I've also put together some other lines, so the resulting config looks like:

A. RepeatLimit 32
B. RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
C. RewriteRule .*\.isrwhlp / [F,I,O]

D. RewriteRule /library$ $0 [I,L]
E. RewriteRule /library/(.*) /library/$1 [I,L]

F. RewriteRule /(?:ljohns|iTunesU|boardinfo|sophosathome|cgi-bin|robots\.txt|_vti_).* $0 [I,L]
G. RewriteRule /\!explore /explore [I,L]

N. RewriteRule (.*\.(?:htc|ico|css|js)) $1 [I,L]
O. RewriteRule /(?:cron|update|xmlrpc)\.php $0 [I,L]

Q. RewriteRule (?:/library2011)?/(?:themes|libraries|modules|files|tmp|sites|misc).* $0 [I,L]
R. RewriteRule /library2011/index.php.* $0 [I,L]
S. RewriteRule /library2011/(.*)\?(.*) /library2011/index.php\?q=$1&$2 [I,L]
T. RewriteRule /library2011/(.*) /library2011/index.php\?q=$1 [I,L]

U. RewriteRule /index.php.* $0 [I,L]
V. RewriteRule /(.*)\?(.*) /index.php\?q=$1&$2 [I,L]
W. RewriteRule /(.*) /index.php\?q=$1 [I,L]



__________________
Regards,
Anton
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum