Forum Moderators: phranque
Long time reader, first time poster.
I've been using these forums alot these days to sort out some .htaccess problems I've been having the last days. But now I'm stuck on what should be a simple issue.
When a users enters my site through "subdomain.domain.com" I'd like to redirect him to "http://www.domain.com/index.php?page=subdomain". But only if the query string parameter "page" has a different value then e.g. 'test'.
Here's the code that I use:
#If the requested subdomain is "subdomain"
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com [NC]
#AND if the requested page is different from "test"
Rewritecond %(QUERY_STRING)!^page=test [NC]
RewriteRule ^(.*)$ http://www.domain.com/index.php?page=subdomain [R]
Any help is appreciated.
- Regards
Chris
[edited by: jdMorgan at 4:31 pm (utc) on Mar. 6, 2006]
[edit reason] De-linked [/edit]
Strangely enough my code reacts as if the two RewriteCond statements had an [OR].
Update
Ok, the following seems to work:
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com [NC]
RewriteCond %{QUERY_STRING}!^page=test&heading_id=([0-9]+)$
RewriteRule ^(.*)$ http://www.domain.com/index.php?page=test [R,L]
- Chris
[edited by: jdMorgan at 4:32 pm (utc) on Mar. 6, 2006]
[edit reason] De-linked. [/edit]