Forum Moderators: phranque
Ok, here is an example:
domain.com & www.domain.com <- if this is used, then do nothing
lala.domain.com, 123.domain.com ... and ALL other subdomains <- if this is used, then load a php file ->
htdocs/index.php?subdomain=lala or 123 ...
Its hard to explain that in english, becouse iam german.
But maybe u understand me and can help me :)
Bye
Unfortunately, according to the charter [webmasterworld.com], which the TOS [webmasterworld.com] says you're supposed to read before posting in this forum, you need to show that you've done your share of the work.
Here's a thread to get you started:
[webmasterworld.com ]
I found a thread with this here:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^user\.example\.com [NC]
RewriteRule ^(.*)$ /blog.php?username=user [R=301]
I rewrite it to this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^user\.example\.com [NC]
RewriteRule ^(.*)$ /subdomain.php?username=user [R=301]
It works, but how can i do that www.example.com & example.com dont use the RewriteRule?
I hope i may reqeuest this here, else iam sorry for it :)
However, I would change this line from:
RewriteRule ^(.*)$ /subdomain.php?username=user [R=301]
RewriteRule .* /subdomain.php?username=user [R=301,L]
RewriteEngine on
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com [NC]
RewriteRule .* /subdomain.php?username=%1 [R=301,L]
Walkthrough: If the host isn't www.example.com or example.com (first case in your first message), go on to the second condition. If the host is a subdomain not mentioned in the previous line (second case), proceed to the RewriteRule. Permanently redirect the user to subdomain.php with username set to the matched pattern from the most recent RewriteCond.
I haven't tried running the code I just gave, so there may be something I'm missing. If there is something wrong, your server's logs can help you see what's going on.
If i use this here:
RewriteRule .* /subdomain.php?username=%1 [R=301,L]
Then it doesn't work. It load and load an load, but nothing happens.
Big Big Thx TO You :)