TurnKey Linux Virtual Appliance Library

Virtualhost www / http access

kodin94's picture

How can I make a virtualhost accessibile through http://eastcoastrolling.info as well as www.eastcoastrolling.info ?

And don`t start with the things like buy the domain haha :D 

Matt Roberts's picture

You should have a record in

You should have a record in your DNS pointing www.eastcoastrolling.info to eastcoastrolling.info

Matt Roberts's picture

Additionally you may need to

Additionally you may need to go into your Virtual Server Options > Networking and Addresses and add your www in the Alternate virtual server names. I don't know if that is required but I needed to do that for my virtual hosts.

Codin Moldovanu's picture

exact

 Can you be more precise ?:) How can I control everything using DNS ?

Codin Moldovanu's picture

Keep In Mind

Well , I want www.example.com to point to example.com 

 

More precise ? I didn`t get much from what you said earlier , sorry.

Codin Moldovanu's picture

Ok. Redirect

step by step ?  

Jeremy Davis's picture

That looks like a much better way of doing it!

Nice work Neil!

Off the top of your head do you know if a similar config is easily done for Lighhtpd? No dramas if you don't, because I could always google it but I'm feeling lazy (and I don't need to know right now cause my redirect page works fine, just wondering for future reference cause your way looks much better).

Jeremy Davis's picture

Thanks anyway

Yeah I'm sure they do too. Just you seem pretty knowledgable and thought you may know off the top of your head.

I just had a quick google and this looks pretty straight forward (for anyone else who is interested).

Jeremy Davis's picture

Here's a redirect page that I use

There are many ways to redirect pages. For a full rundown and pros and cons of different methods some online research is the best bet. Google will give you many ideas and approaches to the issue.

I have successfully used javascript and I am happy to share the code I use (as I robbed it from someone online already anyway). This works fine for me, but requires javascript to be enabled (it will give a warning if javascript is disabled/not available). This page will need to be saved as index.htm on the www root of the server which www.example.com points to.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Redirecting to Correct Server ...</title>
<meta http-equiv="REFRESH" content="5;url=http://example.com">
</head>
<body>
Now redirecting you to the correct server ... Please Wait ...
<br><br>
<noscript>Javascript is required to access this server - please enable to proceed</noscript>
<br><br>
Some more informative text here if you so desire<br>
</body>
<script language="javascript"><!--
location.replace("http://example.com")
//-->
</script>
</html>

Hope that helps.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)