Forum Moderators: phranque
Assuming that [username.gnsite.com...] or [username.gnsite.com...] is used, how should I write in .htaccess such that message 3 by 'username' is shown?
That means, when [username.gnsite.com...] is used, .htaccess should first extract 'username' and then extract '3' and use them both for redirection (to account.php?user=username&message=3)
Currently, this is what I have to redirect [username.gnsite.com...] to account.php?user=username
RewriteCond %{HTTP_HOST}!^www\.gnsite\.com [NC]
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^(.*) %{HTTP_HOST} [C]
RewriteRule ^([^\.]+)\.gnsite\.com account.php?user=$1 [NC,L]
Any help would be greatly appreciated. Thanks in advance.
Rewrite [www.]<username>.example.com/<msg_number>/ --> /account.php?user=<username>&message=<msg_number>
(The leading "www." in the requested domain is optional -- some people think they have to type it, so we'll allow it.)
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)\.example\.com
RewriteRule ^([0-9]+}/$ /account.php?user=%2&message=$1 [L]
Jim