You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ed...@ita.org.mo on 2002/07/31 10:47:29 UTC
Problem about hostname + domain
Hello,
Do you know how to add the following function into httpd.conf ?
When user type http://domain.com , then the web server will auto direct
to http://www.domain.com ?
Thank for your help !
Edward.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Problem about hostname + domain
Posted by Robert Andersson <ro...@profundis.nu>.
Just a correction. I thought this was about the http->https thingy, but in
this case (domain.com->www.domain.com) I would say the PHP method would be
silly (or indeed, stupid) when you have ability alter the server
configuration. You could also have the redirect in an .htaccess file. But,
using ServerAlias is the way to do it; it's the standard way at most hosting
companies.
Regards,
Robert Andersson
----- Original Message -----
From: "Robert Andersson" <ro...@profundis.nu>
To: <us...@httpd.apache.org>
Sent: Wednesday, July 31, 2002 11:26 AM
Subject: Re: Problem about hostname + domain
> EdwardSPL@ita.org.mo wrote:
> > Hello,
> >
> > I just got a function with php from a netfriend :
> > created index.php with this line :
> > <?header("location: http://www.domain.com");?>
> >
> > So, I want to know which setting is the best !
>
> >
> > Thank for your help !
> >
> > Edward.
>
> Either way will work, but the simple Apache redirect is the more elegant
> (and faster) solution. Have you tried it yet?
>
> Regards,
> Robert Andersson
>
> PS. Don't double-post, we'll see your message anyway
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Problem about hostname + domain
Posted by Robert Andersson <ro...@profundis.nu>.
EdwardSPL@ita.org.mo wrote:
> Hello,
>
> I just got a function with php from a netfriend :
> created index.php with this line :
> <?header("location: http://www.domain.com");?>
>
> So, I want to know which setting is the best !
>
> Thank for your help !
>
> Edward.
Either way will work, but the simple Apache redirect is the more elegant
(and faster) solution. Have you tried it yet?
Regards,
Robert Andersson
PS. Don't double-post, we'll see your message anyway
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Problem about hostname + domain
Posted by Ed...@ita.org.mo.
Hello,
I just got a function with php from a netfriend :
created index.php with this line :
<?header("location: http://www.domain.com");?>
So, I want to know which setting is the best !
Thank for your help !
Edward.
Robert Andersson wrote:
> EdwardSPL@ita.org.mo wrote:
>
> > Hello,
> >
> > Do you know how to add the following function into httpd.conf ?
> > When user type http://domain.com , then the web server will auto direct
> > to http://www.domain.com ?
>
> http://httpd.apache.org/docs/mod/core.html#serveralias
>
> Try this (based on the previous config):
>
> <VirtualHost 192.168.200.1:80>
> DocumentRoot "/usr/local/apache/htdocs"
> ServerName mydomain.com
> ServerAlias www.mydomain.com *.mydomain.com
> ServerAdmin root@mydomain.com
> ErrorLog /usr/local/apache/logs/error_log
> TransferLog /usr/local/apache/logs/access_log
> </VirtualHost>
>
> Note the ServerAlias, and remove the *.mydomain.com if you want
>
> Regards,
> Robert Andersson
>
> >
> > Thank for your help !
> >
> > Edward.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Problem about hostname + domain
Posted by Robert Andersson <ro...@profundis.nu>.
EdwardSPL@ita.org.mo wrote:
> Hello,
>
> Do you know how to add the following function into httpd.conf ?
> When user type http://domain.com , then the web server will auto direct
> to http://www.domain.com ?
http://httpd.apache.org/docs/mod/core.html#serveralias
Try this (based on the previous config):
<VirtualHost 192.168.200.1:80>
DocumentRoot "/usr/local/apache/htdocs"
ServerName mydomain.com
ServerAlias www.mydomain.com *.mydomain.com
ServerAdmin root@mydomain.com
ErrorLog /usr/local/apache/logs/error_log
TransferLog /usr/local/apache/logs/access_log
</VirtualHost>
Note the ServerAlias, and remove the *.mydomain.com if you want
Regards,
Robert Andersson
>
> Thank for your help !
>
> Edward.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org