07-12-2008, 09:39 AM
|
#9 (permalink)
|
|
The Acquainted
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
|
Right, I've enabled the wildcard on subdomains on my host but I'm still having a problem with the .htaccess file.
I have three possible solutions, none of which work properly.
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^(www\.)?mydomain\.com$ [NC]
RewriteCond %{HTTP_HOST}<->%{REQUEST_URI} ^(www\.)?([^.]+).*<->/([^/]+) [NC]
RewriteCond %2<->%3 !^(.*)<->\1$ [NC]
RewriteRule ^(.+) /%2/$1 [L]
This one works fine but it redirects myname.mydomain.com to mydomain.com/myname when I need it to redirect to mydomain.com/user/index.php?user=myname and I'm not sure how to change it.
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^w{3}\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com$ [NC]
RewriteRule ^/$ /user/index.php?user=%1 [L]
This one just redirects myname.mydomain.com to mydomain.com.
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ([^.]+)\.mydomain\.com [NC]
RewriteRule ^(.*) http://www.mydomain.com/user/index.php?user=%1 [L]
This one I get an error in the error log saying bad flag delimiters.
|
|
|