Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 

Sign in to follow this  

Recommended Posts

just_me    0

Hi guys,

Ive just built a Linux Webserver, and I have a problem...

website works if you type the actual address: http://www.*****.co.nz

however, if you type *****.co.nz without typing in the www, you will get a "Index of /" with a cgi-bin folder (which you cannot access). What i need, is for this to go to the website, whether or not you type in the www.

Ive have tried to use virtual hosts.... cant get it to work. Im probably doing it wrong..

In section 1 (global) i set:

Port 80

Servername ******

<virtualhost *> DocumentRoot /www/htdocs servername ****** </virtualhost>

and in section 3 or wherever it is in the virtual host part, i set:

<VirtualHost x.x.x.x:80>

ServerName www.*****.co.nz

DocumentRoot /www/htdocs

</VirtualHost>

etc..... Ive tried heaps of other bits of code in other places from people various comments such as Listen x.x.x.x and bindaddress http://*******.co.nz

-------------------------------------------------------------------------------------------

Is using virtual hosts even the right thing for what im trying to do? Im just going off what people have told me...

Any help would be muchly appreciated :)

Share this post


Link to post
Share on other sites
-I-    0
nope, vertual host setting isn't the best way.
mode rewrite would be way better (But it would also disable the posebilities for setting subdomains..

have a look at hos mod_rewrite worsk on apache.org

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×