views:

49

answers:

1

What i have currently:

  • A wildcard dns record. So that every subdomain points to www.galop.gr
  • A dynamically (php) generated .htacces file where i append the following code for every subdomain i want working:

    RewriteCond %{HTTP_HOST} ^fractalbit.galop.gr$ [OR] RewriteCond %{HTTP_HOST} ^www.fractalbit.galop.gr$ RewriteRule ^/?$ http://www.galop.gr/index.php?user=1 [R=301]

Everything is working fine, i just want something more if it is possible.

Right now, if someone enters fractalbit.galop.gr will be redirected to http://www.galop.gr/index.php?user=1

Is it possible to do this BUT keep fractalbit.galop.gr to the address bar of the browser?

Thanks for any replies.

+1  A: 

[R=301] means: do a redirection, and since you're using an absolute address it will also force a redirection, i would just change the rules to this:

RewriteCond %{HTTP_HOST} ^fractalbit.galop.gr$ [OR] 
RewriteCond %{HTTP_HOST} ^www.fractalbit.galop.gr$ 
RewriteRule ^/?$ /index.php?user=1 [L]
kasthor
fractalbit
You're welcomekey part is relative address and removing [ R=301 ], because those things would force a "redirect", without those the server will just rewrite the address internally but will not tell the browser to check on another address The [L] statement means that if the request matches this rule it will not try to match any other rule, it will simply stop processingif you want to pass variables to a subdomain you should specify absolute address starting with http:// but it will force a redirect, to avoid that you may take advantage that both adresses point to the same site
kasthor