This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2004 > Redirect to subdomain with PHP





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Redirect to subdomain with PHP
Freebeeezz

2004-08-31, 12:15 pm

Hello,

I got a domain (www.mydomain.com) that support wildcards eq.
belgium.mydomain.com shows the same page as www.mydomain.com.
I want to redirect the user that types "belgium.mydomain.com" in the
adresbar to a directory "Belgium" wich is on the same server.
I've heared that you can do this redirect with PHP.

Can anyone help me?

Thanks....
Freebeeezz...



Michael Fesser

2004-08-31, 11:15 pm

.oO(Freebeeezz)

>I got a domain (www.mydomain.com) that support wildcards eq.
>belgium.mydomain.com shows the same page as www.mydomain.com.
>I want to redirect the user that types "belgium.mydomain.com" in the
>adresbar to a directory "Belgium" wich is on the same server.
>I've heared that you can do this redirect with PHP.


You don't even need PHP for this. If it's an Apache webserver you can
achieve the same with a mod_rewrite (if available) rule in a .htaccess
file, e.g.


RewriteEngine On

RewriteCond %{HTTP_HOST} ^belgium.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/belgium/$1 [L,R]


Or something like that ...

HTH
Micha
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews