Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to redirect accesses from


I already have mod_rewrite rules to do the opposite:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^(www)\. [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.(.*)\.com [NC]
RewriteRule (.*)$1&name=%1 [R=301,L]

What changes do I need to make to these rules to redirect requests from the script to the subdomain?

share|improve this question
Have you considered simply making this change in the PHP script? – Charles Nov 16 '12 at 21:24
RewriteEngine On

RewriteCond %{QUERY_STRING} ^sub=(.+)&type=(.*)$
RewriteRule .
share|improve this answer
thanks for respons but i am a another problem :: Cette page Web présente une boucle de redirection. input : [] output: ( – user1830181 Nov 17 '12 at 0:13
@KIRA remove the QSA argument in your RewriteRule – Kamil Šrot Nov 17 '12 at 8:58
@KIRA ...or add question mark ? after the %2 w/o any white space - like this – Kamil Šrot Nov 19 '12 at 10:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.