mod_rewrite for both subdomain and query string

mod_rewrite for both subdomain and query string

am 23.11.2007 12:44:16 von JamesG

Hi there,

I have a rewrite rule that redirects x.domain.com to domain.com/
home.php?stSubdomain=x which works fine.

RewriteRule ^([a-zA-Z0-9\-]*)$ home.php?strSubdomain=$1

I need to have it so that i can use x.domain.com/cid?xxxx
(xxxx can be any number from 0-9)

This new url will be rewritten as domain.com/home.php?
stSubdomain=x&cid=xxxx

Any much appreciated :)

Re: mod_rewrite for both subdomain and query string

am 23.11.2007 16:00:20 von shimmyshack

On Nov 23, 11:44 am, JamesG wrote:
> Hi there,
>
> I have a rewrite rule that redirects x.domain.com to domain.com/
> home.php?stSubdomain=x which works fine.
>
> RewriteRule ^([a-zA-Z0-9\-]*)$ home.php?strSubdomain=$1

do you have anything else rewriteconfig for instance, this cannot be
the rule you are using. It doesnt change the sub into domain and
appends the whole request uri to the query string

>
> I need to have it so that i can use x.domain.com/cid?xxxx
> (xxxx can be any number from 0-9)
>

There's not enough info here what do you mean xxxx (i take it its
different from x.domain...)
usually a query string as some name=value&.... so what does xxxx mean
in your example. a name with no value, which can be something like
2345, or 3455, this doesnt make sense to me unless you are
deliberately populating the args array which is not the normal way.

> This new url will be rewritten as domain.com/home.php?
> stSubdomain=x&cid=xxxx
>
> Any much appreciated :)

post more exact details, and we can help you do what you are trying to
achieve.