Link to home
Create AccountLog in
Avatar of jayatallen

asked on

How to redirect a domain to a website


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 , 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

And in DocumentRoot we have a index.html file which has a meta data refresh tag and points to a url.
Like is pointing to a webpage of our domain we own.

Now i need to redirect the domain to

Please let me know how this can implemented.

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

And then create a index.html in /web/vft/ 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,
Avatar of 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:

Avatar of Member_2_4694817

Though not aiming at your original question, I think that the mass virtual hosting feature of apache may interest yuo

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


Thank you your answers.

The suitation is we are not allowed to create the .htaccess file. And we dont want to use Redirect virtual.conf.
Because we dont want to restart the webserver if we want to  change the 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 as
2)Add virtual host block in virtual.conf file for
3)in the docroot for, 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.
Avatar of kadadi_v
Flag of India image

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