Jawel.. alles wat ik hier vind is vastenaam.site.nl -> site.nl/vastenaam
en ik heb juist variabele.site.nl -> site.nl/sites/variabele..
wel pas dan aan dat het zo wordt:
vastenaam.site.nl -> site.nl/sites/vastenaam
of
vastenaam.site.nl -> site.nl/sites.php?user=vastenaam
webmasterworld
I asked about httpd.conf and .htaccess because the mod_rewrite syntax differs slightly between the two environments.
The main problem with your combined code is that ".*" matches anything, so the first rule will always be invoked, and the second rule will never be invoked. Requests for images, CSS files, etc. will also be rewritten to index.php. But there is more to it than that...
Do you have a user named "www"? Probably not, so what should happen if someone accesses your site using www.mydomain.com? Make sure you do not allow a user to create a user-subdomain called "www" -- It could disable a large part of your site.
You will need to come up with a complete plan that includes all possibilities.
The following demonstrates the use of RewriteConds and specific patterns (instead of ".*") to do what I think you said you want to do:
# If no-www domain requested, externally redirect to www domain
RewriteCond %{HTTP_HOST} ^mydomain\.com
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
#
# If www+subdomain domain requested, externally redirect to subdomain without "www"
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.mydomain\.com
RewriteRule (.*) http://%1.mydomain.com/$1 [R=301,L]
#
# If subdomain+www domain requested, externally redirect to subdomain without "www"
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.mydomain\.com
RewriteRule (.*) http://%1.mydomain.com/$1 [R=301,L]
#
# If www domain requested, rewrite html page requests to show.php with query string
RewriteCond %{REQUEST_URI} !^/show\.php
RewriteCond %{HTTP_HOST} ^www\.mydomain.com
RewriteRule ^([^.]+)\.html /show.php?page=$1 [L]
#
# If subdomain requested, rewrite subdomain and html page requests to index.php with query string
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com
RewriteRule ^([^.]+)\.html /index.php?user=%1&page=$1 [L]
#
# If www domain requested, rewrite home page requests to show.php with query string page = "home"
RewriteCond %{REQUEST_URI} !^/show\.php
RewriteCond %{HTTP_HOST} ^www\.mydomain.com
RewriteRule ^$ /show.php?page=home [L]
#
# If subdomain requested, rewrite home page requests to index.php with query string user=subdomain & page="home"
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com
RewriteRule ^$ /index.php?user=%1&page=home [L]
Any requests for files that do not end in ".html" will not be rewritten to the scripts, except for home page requests in the form "www.mydomain.com/" or "subdomain.mydomain.com/" where the "filename" is blank.
You showed two php files, "show.php" and "index/php" -- I have kept them separate in the code above, but you should be able to correct the code if you really use only "index.php".
This may or may not cover all possibilities on your site -- but you will have to. Study the resources cited in our charter until you understand how this code works, and then modify it to suit your needs. This code is untested.