Visibility of rewrites

Aug 25, 2008 at 2:31 PM
Hello there,

I am very sorry if this question has already been answered or if the answer is in the readme, but I have not been able to find it.
I had the impression that rewrites were 'hidden', 'behind the screens' kinds of things. Is this impression incorrect?

I have what my provider calls an 'alias' for three domains (phdthesis.nl, interventiondesign.eu and ecstasyresearch.eu) that all refer to my site at gjyp.nl (because it's much cheaper than seperate hosting accounts for every domain).

The corresponding websites are in subdirectory's of the 'wwwroot' folder of the gjyp.nl domain.

I would like to 'make the world believe' that the website that they're visiting, for example at 'ecstasyresearch.eu' is not just in a subdirectory of the gjyp.nl website.

I have the following rewrites for this ecstasyresearch.eu domain:

RewriteCond  %{HTTP_HOST}  ^ecstasyresearch.eu$         [I]
RewriteRule  ^/ecstasyresearch/(.*)$        /$1         [I]

RewriteCond  %{HTTP_HOST}  ^ecstasyresearch.eu$         [I]
RewriteRule  ^(.*)$        /ecstasyresearch$1           [I,L]

RewriteCond  %{HTTP_HOST}  ^www.ecstasyresearch.eu$     [I]
RewriteRule  ^/ecstasyresearch/(.*)$        /$1         [I]

RewriteCond  %{HTTP_HOST}  ^www.ecstasyresearch.eu$     [I]
RewriteRule  ^(.*)$        /ecstasyresearch$1           [I,L]

(I know, they're probably incorrect, but I don't really know much about regular expressions . . . And they work :-))

When you visit http://ecstasyresearch.eu, everything is fine. But, when you click the only link so far (:-)) to '"reviews/qualitative/2008", this is rewritten to the folder /ecstasyresearch/reviews/qualitative/2008, which is correct, because it is exactly where this page is stored relative from gjyp.nl's 'wwwroot' folder, but the user sees the url "http://www.ecstasyresearch.eu/ecstasyresearch/reviews/qualitative/2008/" in the address bar.

I assume that this is supposed to be how it works, but I can't understand the inconsistency (if the user types in 'ecstasyresearch.eu' in his address bar, this url is clearly also rewritten to /ecstasyresearch, but here, the address bar doesn't show this) . . .

What am I missing here?

For another site, at http://interventiondesign.eu, working with Drupal, I set 'setting.php' such that Drupal actually fixes this.

But I don't understand it :-)

I know that I should just learn these things before muddling around, but I am afraid I lack the time for this . . .

Could somebody perhaps please help me or give me a hint as to what's happening?

Kind regards in advance,

Gjalt-Jorn
Coordinator
Aug 25, 2008 at 2:46 PM
Edited Aug 25, 2008 at 2:48 PM
(I know, they're probably incorrect, but I don't really know much about regular expressions . . . And they work :-))

No, they don't work. I don't understand your rules. They seem to be not mutually consistent, if you nkow what I mean. One of the rules you show actually does the inverse of what you say you want. The first rule says, if someone types in a URL that looks like http://ecstasyresearch.eu/ecstasyresearch/something/foo/bar, then it gets rewritten, on the server side (invisibly? as you might say), to http://ecstasyresearch.eu/something/foo/bar. Then, *that* rewritten URL on the server side is activated and run.

From your description, your rules do not do what you want them to do. You want something closer to this:

RewriteCond  %{HTTP_HOST}  ^ecstasyresearch.eu$         [I]
RewriteRule  ^/(.*)$        /ecstasyresearch/$1         [I]
I assume that this is supposed to be how it works, but I can't understand the inconsistency (if the user types in 'ecstasyresearch.eu' in his address bar, this url is clearly also rewritten to /ecstasyresearch, but here, the address bar doesn't show this) . . .

The following rule from your ruleset does what you described:

RewriteCond  %{HTTP_HOST}  ^www.ecstasyresearch.eu$     [I]
RewriteRule  ^(.*)$        /ecstasyresearch$1           [I,L]

The address bar is not expected to show the result of a rewrite.

But I don't understand it :-) I know that I should just learn these things before muddling around, but I am afraid I lack the time for this . . .

I have much clearer answers to all your questions, but Sorry, I just don't have time right now to write it all down. . . .

:0 . My suggestion to you is to do 15 minutes of reading and understand how rewrites work. Then spend 15 minutes of testing with the testdriver on the url patterns you are trying to manipulate. There is no substitute for doing it yourself. You will spend much more time trying to explain it, than it will take YOU yourself to just do it. You are a smart guy. I understand you are busy.  We are all busy.  If you didn't OD on ex, you should be able to understand URL rewriting fairly quickly.  

Aug 25, 2008 at 3:34 PM
Thank you for your very swift and useful answer!!!

I am afraid, though, that ‘doing applied psychological research’-intelligence is something else than ‘understanding regular expressions, filters, and webserver behaviour’-intelligence :-)

I infer this from the given that I have seriously spent a lot of time reading the readme and playing with both the testdriver and the ‘real thing’ (downloading, editing, uploading, etc), but I just lack either the intelligence for thinking this abstractly, or I’m just missing a link in the ‘mental model’ I have to represent what’s happening here.

But, I understand your point, that I have to do to learn, and I will keep trying to gain this understanding myself. If I really don’t manage, I will come back to you when I’m really desperate J
Actually, if I do manage, I will also come back so that perhaps others may benefit from the solution I may find :-)

For now, I can’t resist but share my train of thought so far, because I tried implementing the rule in your post, but again the same thing happened that caused me to come up with the rules that you so fittingly described as mutually inconsistent . . .

I have now changed the rule to what I actually had at first:

  RewriteCond %{HTTP_HOST} ^ecstasyresearch.eu$ [I]
  RewriteRule ^/(.*)$ /ecstasyresearch/$1 [I,L]

However, this rewrites one time too often, as the log testifies. When you type in ‘ecstasyresearch.eu’, everything goes fine:

  New Url: '/'
  ApplyRules (depth=0)
  Rule 1 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 17): /ecstasyresearch/
  Last if Match
  ApplyRules: returning 1
  Rewrite Url to: '/ecstasyresearch/'

Exactly what I want. However. :-) When you then press the link (see first post):

  New Url: '/reviews/qualitative/2008'
  ApplyRules (depth=0)
  Rule 1 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 41): /ecstasyresearch/reviews/qualitative/2008
  Last if Match
  ApplyRules: returning 1
  Rewrite Url to: '/ecstasyresearch/reviews/qualitative/2008'
  HttpFilterProc SF_NOTIFY_URL_MAP
  HttpFilterProc SF_NOTIFY_URL_MAP
  HttpFilterProc SF_NOTIFY_AUTH_COMPLETE
  DoRewrites
  New Url: '/ecstasyresearch/reviews/qualitative/2008/'
  ApplyRules (depth=0)
  Rule 1 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 58): /ecstasyresearch/ecstasyresearch/reviews/qualitative/2008/
  Last if Match
  ApplyRules: returning 1
  Rewrite Url to: '/ecstasyresearch/ecstasyresearch/reviews/qualitative/2008/'
  HttpFilterProc SF_NOTIFY_URL_MAP

So, it re-interprets the rewritten URL and then it adds ‘/ecstasyresearch/’ AGAIN. Now, I solved this by adding the rule you can see in my first post (before the current rule):

  RewriteCond %{HTTP_HOST} ^ecstasyresearch.eu$ [I]
  RewriteRule ^/ecstasyresearch/(.*)$ /$1 [I]

So that the second time, the ‘/ecstasyresearch/’ is first removed; then, when IIRF adds it again, the URL is not incorrect.

I really don’t understand why IIRF doesn’t keep looping and adding “/ecstasyresearch/“ to the front of the url. It clearly loops (or, re-interprets the rewritten url) at least once. Why does it stop after the second time? What has changed from the first time to trigger this break?

(finished sharing train of thought; I will come back to this if I will not manage to find the answer, or if I will actually :-))

Again, thank you very much for your time and help!!!!

Gjalt-Jorn
Aug 25, 2008 at 3:37 PM
It is the slash, isn't it?

I'll get back to this in a few minutes.

Ahum.

<anticipatingly (?) becoming embarrassed>
Coordinator
Aug 25, 2008 at 3:46 PM

I don't understand exactly what is going on either, but,. you can restrict your rule from firing by excluding URL patterns.  Like so:

  RewriteCond %{HTTP_HOST} ^ecstasyresearch.eu$ [I]
  RewriteRule ^/(?!ecstasyresearch)(.*)$ /ecstasyresearch/$1 [I,L]

The above says, only rewrite when the URL does not begin with ecstasyresearch (and when the host is ecstasyresearch.eu). Wiith this rule you will never have http://ecstasyresearch.eu/ecstasyresearch/foo rewritten to http://ecstasyresearch.eu/ecstasyresearch/ecstasyresearch/foo .

Aug 25, 2008 at 4:15 PM
Ah, I have just learned that this is a negative lookahead. That was exactly what I had been looking for earlier (but couldn't find) as alternative solution to the 'mutually inconsistent' solution I ended up adopting.

That's actually really cool :-)

I have made a slight adjustment, adding a slash within the lookahead (my stylesheet starts with 'ecstasyresearch' :-)):
  RewriteCond %{HTTP_HOST}                ^ecstasyresearch.eu$ [I]
RewriteRule ^/(?!ecstasyresearch/)(.*)$ /ecstasyresearch/$1 [I,L]
This solution works indeed . . . But it again visibly 'prefixes' the url with '/ecstasyresearch/' . . .

Is it possible that my provider actually does something wrong? Is it possible that the strange behaviour is actually independent from IIRF?

Ah. Perhaps the problem is still the trailing slash. Perhaps the webserver itself 'rewrites' url's, that refer to the name of a folder but lack a trailing slash, and does this visibly. This would explain the weird behaviour. So I'll add the condition to check whether something is an existing folder, and if so, I also add the trailing slash using IIRF. This should prevent the webserver from muddling around. If this indeed IS the problem of course.

I'll get back again :-)
Aug 25, 2008 at 5:05 PM
Argh, I just don't get it. This is just too frustrating for words :-)

I'm ending up in endless loops (well, max 8 of them, but you know what I mean :-)).

I'm trying to tell it to add a trailing slash if the specified url is a folder that exists, but of course that is also true for '/'. So then it becomes '//'. So I tried to tell it to first, remove any existent trailing slash. Then, if the result is an existing folder, add one.

But I don't manage to get it working. This is so frustrating. I know that all this is possible, and that if I knew how regular expressions worked (more than the utterly cursory knowledge I currently have), it would probably be quite easy. Grr. This ends up in loops:

   RewriteCond %{REQUEST_FILENAME}    -d
   RewriteRule ^/(.*)$ /$1/           [I]

   RewriteRule ^(.*)//$ $1/           [I]

And I really don't understand . . . The first one is supposed to just add a trailing slash, right (if it's an existing dir)? And the second one is supposed to remove one trailing slash if there are two. This should solve the problem, but . . .

Mon Aug 25 19:03:32 2008 - New Url: '/'
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=0)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 2): //
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=1)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 3): ///
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=2)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 4): ////
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=3)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 5): /////
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=4)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 6): //////
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=5)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 7): ///////
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=6)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 8): ////////
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=7)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 9): /////////
Mon Aug 25 19:03:32 2008 - ApplyRules (depth=8)
Mon Aug 25 19:03:32 2008 - Rule 1 : 2 matches
Mon Aug 25 19:03:32 2008 - EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\' against pattern '-d'
Mon Aug 25 19:03:32 2008 - EvaluateConditionList: TRUE, Rule will apply
Mon Aug 25 19:03:32 2008 - Result (length 10): //////////
Mon Aug 25 19:03:32 2008 - Iteration stopped; reached limit of 8 cycles.
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - ApplyRules: returning 1
Mon Aug 25 19:03:32 2008 - Rewrite Url to: '//////////'

(it's as if it restarts every time . . . But in other logs it seems to work through the specs in the ini file progressively . . . ? )

Ok, for now I have to go to the gym :-)
But I will get back to this. Hopefully not during working times then though, I should we working on a literature review :-)

At any rate, thanks for all your help so far!!!!!
Aug 25, 2008 at 8:06 PM
I am really stuck. I am trying to get it to append a slash to all folders after the addition of "/ecstasyresearch" if need be . . .

I have this (took out rules about other domains):

  RewriteCond %{HTTP_HOST} ^ecstasyresearch.eu$ [I]
  RewriteRule ^/(?!ecstasyresearch/)(.*)$ /ecstasyresearch/$1 [I]

  RewriteCond %{HTTP_HOST} ^ecstasyresearch.eu$ [I]
  RewriteCond %{REQUEST_FILENAME}               -d
  RewriteRule ^/(.*)$                  /$1/     [I]

  RewriteCond %{REQUEST_FILENAME}    -d
  RewriteRule ^/(.*)//$ /$1/         [I,L]

What it does:

  LogFile re-opened.
  HttpFilterProc SF_NOTIFY_URL_MAP
  HttpFilterProc SF_NOTIFY_AUTH_COMPLETE
  DoRewrites
  New Url: '/reviews/qualitative/2008'
  ApplyRules (depth=0)
  Rule 1 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 41): /ecstasyresearch/reviews/qualitative/2008
  ApplyRules (depth=1)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\reviews\qualitative\2008' against pattern '-d'
  EvaluateConditionList: FALSE, Rule does not apply
  Rule 3 : -1 (No match)
  Rule 4 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^interventiondesign.eu$'
  Cond : -1 (No match)
  EvaluateConditionList: FALSE, Rule does not apply
  Rule 5 : -1 (No match)
  Rule 6 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^www.interventiondesign.eu$'
  Cond : -1 (No match)
  EvaluateConditionList: FALSE, Rule does not apply
  Rule 7 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^phdthesis.nl$'
  Cond : -1 (No match)
  EvaluateConditionList: FALSE, Rule does not apply
  Rule 8 : -1 (No match)
  Rule 9 : -1 (No match)
  Rule 10 : -1 (No match)
  ApplyRules: returning 0
  ApplyRules: returning 1
  Rewrite Url to: '/ecstasyresearch/reviews/qualitative/2008'
  HttpFilterProc SF_NOTIFY_URL_MAP
  HttpFilterProc SF_NOTIFY_URL_MAP
  HttpFilterProc SF_NOTIFY_AUTH_COMPLETE
  DoRewrites
  New Url: '/ecstasyresearch/reviews/qualitative/2008/'
  ApplyRules (depth=0)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 43): /ecstasyresearch/reviews/qualitative/2008//
  ApplyRules (depth=1)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 44): /ecstasyresearch/reviews/qualitative/2008///
  ApplyRules (depth=2)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 45): /ecstasyresearch/reviews/qualitative/2008////
  ApplyRules (depth=3)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 46): /ecstasyresearch/reviews/qualitative/2008/////
  ApplyRules (depth=4)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 47): /ecstasyresearch/reviews/qualitative/2008//////
  ApplyRules (depth=5)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 48): /ecstasyresearch/reviews/qualitative/2008///////
  ApplyRules (depth=6)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 49): /ecstasyresearch/reviews/qualitative/2008////////
  ApplyRules (depth=7)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 50): /ecstasyresearch/reviews/qualitative/2008/////////
  ApplyRules (depth=8)
  Rule 1 : -1 (No match)
  Rule 2 : 2 matches
  EvaluateCondition: checking 'ecstasyresearch.eu' against pattern '^ecstasyresearch.eu$'
  Cond : 1 (match)
  EvaluateCondition: checking 'c:\domains\gjyp.nl\wwwroot\ecstasyresearch\reviews\qualitative\2008\' against pattern '-d'
  EvaluateConditionList: TRUE, Rule will apply
  Result (length 51): /ecstasyresearch/reviews/qualitative/2008//////////
  Iteration stopped; reached limit of 8 cycles.
  ApplyRules: returning 1
  ApplyRules: returning 1
  ApplyRules: returning 1
  ApplyRules: returning 1
  ApplyRules: returning 1
  ApplyRules: returning 1
  ApplyRules: returning 1
  ApplyRules: returning 1
  ApplyRules: returning 1
  Rewrite Url to: '/ecstasyresearch/reviews/qualitative/2008//////////'

I'm going to spend some time with my girlfriend now and then sleep. Perhaps tomorrow this makes sense . . .

I have the feeling that the webserver is doing stuff it isn't supposed to do . . . I don't know.

Good night :-)
Aug 26, 2008 at 10:23 AM
It works!!!

For some reason that is still beyond me, all I had to do was change the <a href> that I had to refer to "reviews/qualitative/2008/" instead of "reviews/qualitative/2008" (without the trailing slash) . . .

Apparently it is 'bad practice' to leave out that trailing slash? At any rate, now it works. The complete ini file I have now is:
  RewriteCond %{HTTP_HOST}                     ^ecstasyresearch.euRADEDITORFORMATTED_1nbsp;        [I]
RewriteRule ^/(?!ecstasyresearch/)(.*)RADEDITORFORMATTED_1nbsp;     /ecstasyresearch/$1          [I]

RewriteCond %{HTTP_HOST}                     ^www.ecstasyresearch.euRADEDITORFORMATTED_1nbsp;    [I]
RewriteRule ^/(?!ecstasyresearch/)(.*)RADEDITORFORMATTED_1nbsp;     /ecstasyresearch/$1          [I]

RewriteCond %{HTTP_HOST}                     ^interventiondesign.euRADEDITORFORMATTED_1nbsp;     [I]
RewriteRule ^/(?!interventiondesign/)(.*)RADEDITORFORMATTED_1nbsp;  /interventiondesign/$1       [I]

RewriteCond %{HTTP_HOST}                     ^www.interventiondesign.euRADEDITORFORMATTED_1nbsp; [I]
RewriteRule ^/(?!interventiondesign/)(.*)RADEDITORFORMATTED_1nbsp;  /interventiondesign/$1       [I]

RewriteCond %{HTTP_HOST}                     ^phdthesis.nlRADEDITORFORMATTED_1nbsp;              [I]
RewriteRule ^/(?!phdthesis/)(.*)RADEDITORFORMATTED_1nbsp;           /phdthesis/$1                [I]

RewriteCond %{HTTP_HOST}                     ^www.phdthesis.nlRADEDITORFORMATTED_1nbsp;          [I]
RewriteRule ^/(?!phdthesis/)(.*)RADEDITORFORMATTED_1nbsp;           /phdthesis/$1                [I]

RewriteCond  %{HTTP_HOST}                    ^gjyp.nlRADEDITORFORMATTED_1nbsp;                   [I]
RewriteRule  ^/personal/(.*)RADEDITORFORMATTED_1nbsp;               /old/$1                      [I]

RewriteCond  %{HTTP_HOST}                    ^www.gjyp.nlRADEDITORFORMATTED_1nbsp;               [I]
RewriteRule  ^/personal/(.*)RADEDITORFORMATTED_1nbsp;               /old/$1                      [I]
So now it does look a lot neater and no longer mutually inconsistent, but the problem was apparently that webservers are not happy with links like "reviews/qualitative/2008". I used your rule:

  RewriteRule   ^/([^.?]+[^.?/])$      /$1/     [R=301]

to add a trailing slash to all paths (exactly what I was looking for), and then I noticed that the stylesheet and the file, linked to from the index.php that was at "reviews/qualitative/2008", were looked for in the folder 'qualitative', rather than in the folder '2008':

  Tue Aug 26 11:44:25 2008 - New Url: '/reviews/qualitative/ecstasyresearch%20in%20style.css'

And obviously, that wouldn't work.

So, this is probably some 'rule of internet physics' or convention that I was unaware of. Apparently, you're not allowed to link to a folder without specifying the trailing slash.

Aha. I just tried out what would happen when I typed in the address bar <b>http://http://ecstasyresearch.eu/reviews/qualitative/2008/</b>
Works perfectly. Now, when I type in <b>http://ecstasyresearch.eu/reviews/qualitative/2008</b> (without the trailing slash), the 'ecstasyresearch' folder is visibly added (e.g., the address bar shows <b>http://ecstasyresearch.eu/ecstasyresearch/reviews/qualitative/2008/</b>

When I add your rule again (to add trailing slashes using IIRF, slightly modified to not do the R=301 thing anymore, because I don't know what it entails exactly, and I don't want to tell the browser anything at all):

  RewriteRule   ^/([^.?]+[^.?/])$      /$1/     [I]

Then, when you type in the address bar <b>http://ecstasyresearch.eu/reviews/qualitative/2008</b> (without trailing slash), the same thing happens again with the links to files 'missing' the final folder, e.g. the stylesheet is looked for in the folder "http://ecstasyresearch.eu/reviews/qualitative" instead of the folder "http://ecstasyresearch.eu/reviews/qualitative/2008".

So it seems that I can choose:
- either everything works like it should, but there is the faint possibility that the folder 'ecstasyresearch' is shown;
- or the folder is never shown but websites can be broken.

Of course, whether the folder is shown is not REALLY important. Nobody visits my websites anyway, generally. And if they do, they don't care about the folder. But it just annoys me to hell that I can't understand this, and that I can't get it to work like I want it to work . . .

Anyway. I will go for the 'website works, folder can be visible' option, and leave it for now. Perhaps I will once have the time to figure this out in my spare time, rather than in my working hours :-)

At any rate, thank you very much for having thought along and helping me!!!

Kind regards,

Gjalt-Jorn
Aug 26, 2008 at 10:26 AM
PS: thanks also for the negative lookahead thing :-)
Coordinator
Aug 29, 2008 at 5:36 AM
glad it works!
Aug 29, 2008 at 9:31 AM
<link href="/Css/Wiki.css" type="text/css" rel="stylesheet">

That’s what I thought too :-)

Followed by “but I don’t understand it yet” :-)

However, I found this http://www.fiftyfoureleven.com/weblog/search-engines/trailing-slashes-best-practice

(the URI itself is already quite clear :-))

I assume the webserver does some rewriting itself to add trailing slashes if they're missing after IIRF, and then the url rewritten by the webserver is offered to IIRF again or something like that?

Whatever, it works (kind of) :-)

Thanks very much for your help!!!

PS: I also use IIRF for some other things, and in general, I must say, it's an ingenious program, so that you for writing the thing, too :-)