Link to home
Create AccountLog in
Avatar of jayatallen
jayatallen

asked on

How to redirect a domain to a website

Hi,

I have recently started working with Apache and DNS stuff.Actually i need to perform a whole  domain redirect to a webpage.Let me describe the suitation. The websites name are sake for example purpose only.
We own a domain , www.clearlake.com hosted on Apache 2.0. We have a seperate virtual.conf file  maintaining few small websites. The way we have configured our virtual.conf file is for each virtual host we have defined
ServerName
DOcumentRoot

And in DocumentRoot we have a index.html file which has a meta data refresh tag and points to a url.
Like www.clearlakeliquid.com is pointing to a webpage of our domain we own. www.clearlake.com/C1SNNT_enUS357US358&aq

Now i need to redirect the domain  www.clearlake.com.mx to www.clearlake.com/answer.py?hl=en&answer=34444&from=34443&rd=1#A2

Please let me know how this can implemented.

The plan we have is to create a CNAME for www.clearlake.com as www.clearlake.com.mx
and then create a vitrualhost  in the virtual.conf file for www.clearlake.com  as
<VirtualHost *:port #>
ServerName www.clearlake.com.mx
DocumentRoot /web/vft/www.clearlake.com.mx
</Virtualhost>

And then create a index.html in /web/vft/www.clearlake.com.mx directory which will meta data refresh.
My question is can i create a Cname mentioned above? and the plan outlined above is feasible?
Please let me know.

Thank you,
Joe
Avatar of kadadi_v
kadadi_v
Flag of India image

You can use .htaccess file and define a rule to Redirect your domain to required domain URL.
Please Check this:

http://kb.mediatemple.net/questions/242/How+do+I+redirect+my+site+using+a+.htaccess+file%3F

Regards,
vijay
Avatar of Member_2_4694817
Member_2_4694817

Though not aiming at your original question, I think that the mass virtual hosting feature of apache may interest yuo
http://httpd.apache.org/docs/2.0/vhosts/mass.html

This would only require you to create the corresponding directories per vhost, not to add a special config entry in apache. (Of course the DNS stuff need to be done as well)

If there is a regular pattern in the way you translate hostnames to URLs, you may even be able to use a single .htaccess file as described by kakadi_v. In that case, the subdirectories per host may even be shared, i.e. they could be symlinks to a single directory.
Avatar of jayatallen

ASKER

Thank you your answers.

The suitation is we are not allowed to create the .htaccess file. And we dont want to use Redirect 301.in virtual.conf.
Because we dont want to restart the webserver if we want to  change the www.clearlake.com.mx to another webpage in future.
My question is as already we have our setup, we own the webserver boxes, the planned i have outlined will work or not?
That is :
1) create a CNAME for  www.clearlake.com as www.clearlake.com.mx.
2)Add virtual host block in virtual.conf file for www.clearlake.com
3)in the docroot for www.clearlake.com.mx, place a index.html file.
4)have a meta-data refesh URL code in the index.html page.

Please help and sorry for stupid question.
ASKER CERTIFIED SOLUTION
Avatar of kadadi_v
kadadi_v
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account