Forum Moderators: phranque
example.com/user/%1 -> example.com/user?u=%1
Now what I want to do is take this to subdomains, EG
%1.example.com -> example.com/user?u=%1
I have this, but it simply returns 404 errors:
RewriteEngine On
RewriteCond %{HTTP_HOST}!^www\.example\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/user.php?u=%1 [L,R] Server config is Apache 1.3.37 (Unix) with PHP 5.2.3
[edited by: jdMorgan at 4:37 pm (utc) on Jan. 28, 2008]
[edit reason] example.com [/edit]
RewriteEngine On
#
RewriteCond $1 !^user\.php$
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
RewriteRule (.*) /user.php?u=%1 [L]
Jim
[edited by: jdMorgan at 4:37 pm (utc) on Jan. 28, 2008]
You have to define your subdomains in your DNS zone file (explicitly or as a wild-card), and your server must also be configured to 'route' those subdomains (or all such wild-card subdomains) to your 'account' filespace (this is typically done with a ServerAlias directive in httpd.conf or conf.d).
It sounds like one or both of these steps have not been done.
Jim