Web Hosting Talk







View Full Version : Subdomain Redirection...


Cael
04-23-2001, 05:48 PM
One of my clients ask me to redirect subdomain.hisdomain.com to hisdomain.com/subdomain , is there anyway to do so without installing any script ?

Or if it does require a script to do so, can you recommend any easy to install redirection script to me please?

Thanks in advance. :) I need them in a hurry...

Domenico
04-24-2001, 06:19 AM
Forwardpro at http://www.go2cgi.com does do the trick and a free one at http://www.ericscgi.com/re.html does work very good also.

Hope this answers your question a bit...

Domenico

:cool:

Cael
04-24-2001, 11:13 AM
Emm...
I don't know why, I can't get it working probably.

I tried a few scripts, and all just keep pointing sub.domain.com to www.domain.com instead of domain.com/sub .

I heard that someone suggested me to mess with mod_rewrite on apache . How could I do so ?

Domenico
04-24-2001, 11:39 AM
Oh, I thought you knew. You must turn mod rewrite off in httpd.conf

You must set it from on to off for the domain you want it to work...

Cael
04-24-2001, 12:02 PM
Oh !!!

:(

I tried from simple php scripts to those confusing perl scripts, and never know about this. :( .

Now I know. :) Thanks pal... I owe you a dinner...

kentaurus
04-24-2001, 10:32 PM
Telnet to your raq, type su -

Open your httpd.conf
pico /etc/httpd/conf/htttpd.conf

Look for <virtualhost subdomain.hisdomain.com>

Add below DocumentRoot in that virtualhost.....
RedirectPermanent / http://hisdomain.com/subdomain

Restart apache
/etc/rc.d/init.d/httpd restart

that's it :)

Domenico
04-25-2001, 06:29 AM
Hmm, a nice plate full off gamba's/scampi's and a bottle of wine will do thank you ;-)

Cael
04-25-2001, 07:29 AM
I changed this....
RewriteEngine off

And now, the subdomains are not pointing back to www.domain.com. However, all the subdomains are not responding now. It makes no different for the subdomains I use a script to point them to a folder, or subdomains which I didn't even touch them.

Any idea?

Cael
04-25-2001, 07:39 AM
Originally posted by kentaurus
Telnet to your raq, type su -

Open your httpd.conf
pico /etc/httpd/conf/htttpd.conf

Look for <virtualhost subdomain.hisdomain.com>

Add below DocumentRoot in that virtualhost.....
RedirectPermanent / http://hisdomain.com/subdomain

Restart apache
/etc/rc.d/init.d/httpd restart

that's it :)


I can't see any <virtualhost subdomain.hisdomain.com>

What I can see is...


NameVirtualHost xxx.xxx.xxx.xxx
<VirtualHost xxx.xxx.xxx.xxx>
ServerName www.domain.com

xxx.xxx.xxx.xxx refers to the IP of the domain.com.


So how ?

Tobbe
04-25-2001, 10:24 AM
Hi Donovan,
I think kentaurus missunderstod you. His way only redirects 1 subdomain to 1 directory.

The thing I think you need to do, to make everything work, is to add this line to your httpd.conf file.
ServerAlias *.domain.com

This makes *.domain.com point to domain.com and you will be able to use the script for redirection.

Hope it works,

/Tobbe

Cael
04-25-2001, 11:23 AM
Thanks pal... I will try it :)

Cael
04-29-2001, 07:21 AM
Now I need to redirect many subdomains, how ?

I want to use mod_rewrite for that. Anyone can help?

I don't want to use virtualhost thing for this, too much work. And scripts don't work on my raq. So I guess the best way is through mod_rewrite.

Please help me.

I want to forward sub.domain.com to domain.com/sub .