user can be any name! If it is not found in the database, it is redirected to setp.domain.com
i added the RewriteRule ^(.)//(.)$ $1/$2
U,I to fix a double slash problem caused by among others empty
variables...

However, it does not work. What am i missing? I know the 'N' flag is not used here, but it should run the rule untill it can't run any more...

It either rewrites setup.domain.nl to the correct place (root of the default website) or it rewrites username.domain.nl to the correct place (defaultwebsite/username) not both. Logfile for the first situation:

I am pretty sure that is not what you meant, because (^.) doesn't make sense to me. I think what you pasted was right, but the forum engine is interpreting your rule string as markup. If you want to enclose rules in these posts you need to enclose the block
of text in double-curly braces, to prevent interpretation of the rule string as markup. like this:

{ {
text here
} }

(Include no spaces between the curlies.) Assuming I am right about the markup, I think your first two RewriteCond statements are probably more like this:

What you seem to want is to exclude www.domain.com, and setup.domain.com, but allow things like snarfle.domain.com and also allow ewww.domain.com, assuming ewww is a valid user name. In that case you probably want a regex like this, in that first RewriteCond:

^(?!\b(www|setup)\b)([^\.]+)\.([^\.]+)\.([^\.]+)$

Looks complicated, eh? Let's take it by parts.

The first part:
(?!\b(www|setup)\b). Let's look at the inside of it.
\b(www|setup)\b says, match here only if the first word is not www or setup. The \b is a zero-width assertion which matches only on a word boundary. So in this case, www will match, and wwww will not match. That is then wrapped in a (?!...), which is
a negative lookahead. It says, match here (but don't capture) only if the inside (...) is NOT matched. In other words, the whole first part only matches if the first word is not www or setup. wwww or ewwww or www3 will all match. www will not match.

The rest of the regex is repetitive. There are three stanzas separated by dots. The
([^\.]+) captures each stanza.

It is a bit curious because EVERY distinct hostname will be rewritten to the same URL. In other words, fred.domain.com will be rewritten to /domain and wilma.domain.com will be rewritten to /domain, and Alexander.domain.com will be rewritten to the same URL,
/domain. Is that what you want?

I added the L flag and removed the I and N flags as unnecessary and useless, respectively. But this only matches a URL that has am empty path. You had given these as examples:

#

incoming url

rewrite result

1

user.domain.com

/domain

2

setup.domain.com

/

3

www.domain.com

/

4

user.domain.com/blog/showitem/id/1/rsp/2/var/3/title.html

/domain/showitem.asp?id=1&rsp=2&var=3

5

user.domain.com/members/blog/edit/id/1/rsp/2/title.html

/domain/members/edit.asp?id=1&rsp=2

The rule I gave above works for case #1, #2 and #3. Again, those are all empty paths.

Is that what you want?

I would add these as other example outcomes to illustrate the point:

#

incoming url

rewrite result

6

cheeso.alpha.com

/alpha

7

alexander.tempuri.org

/tempuri

8

fred.YouKnow.com

/YouKnow

9

barney.YouKnow.com

/YouKnow

Is that what you want? With the one rule I gave you above, that's what you would get.