Web Hosting Talk







View Full Version : SubDomain Redirection


webtech
07-07-2001, 12:50 PM
I have a client that wants like

http://articles.theirdomain.com to goto http://www.theirdomain.com/articles/ I was told to set A Name records up and then put a index.pl in their rootweb. It does not work, wondering if any of you have suggestions. I will post the index.pl if you request it.:eek:

Lantins
07-07-2001, 07:46 PM
I have a few client's that requested the same thing. Below I well tell u how :D

Ok, u need to ssh to your server as root.

U need to edit your httpd.conf file, if u use a RAQ3 it should be "/etc/httpd/conf/httpd.conf"
U need to go to the BOTTEM of the file and add this line.

Include /etc/httpd/conf/other.inc.conf

Save the file.

Now u need to make a new file called "other.inc.conf"

enter some thing like this

#<START COPY HERE>
<VirtualHost 999.999.999.999>
ServerName articles.theirdomain.com
ServerAdmin admin
DocumentRoot /home/sites/site4/web/articles
RewriteEngine on
RewriteCond %{HTTP_HOST} !^999.999.999.999(:80)?$
RewriteCond %{HTTP_HOST} !^articles.theirdomain.com(:80)?$
RewriteRule ^/(.*) http://articles.theirdomain.com/$1 [L,$
RewriteOptions inherit
</VirtualHost>
#<STOP COPY HERE>

Save your file.

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

Should be working find :)
I hope this helped.

Luke Antins

Chicken
07-07-2001, 08:38 PM
There was another post that suggested this (in the include file):

<VirtualHost 192.168.1.1> #Virtual server IP
ServerName subname.yourdomain.com #subdomain
ServerAdmin admin
DocumentRoot /path/to/the/home/directory/
ServerAlias subname.yourdomain.com #subdomain
AddHandler cgi-wrapper .cgi #This part is optional
Addhandler cgi-wrapper .pl #This part is ottional
</VirtualHost>

Now maybe both work, but... errr.. well... is there some guide as to what you need to put exactly? I've never done a sub like this but am thinking of trying it just for the heck of it, just saw two posts with different info. I realize some of this could be added to an .htaccess file if needed, but... well you know... any thoughts?

Lantins
07-07-2001, 08:49 PM
Well, it depends on what u are wanting it to do, if you want serten things u need to vary your file, but what i sead works FINE for me :)

Luke Antins