You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mark McCulligh <mm...@visualtech.ca> on 2003/05/09 16:35:41 UTC

[users@httpd] Setting up Redirect using Apache

I am trying to setup redirection using Apache and below is the example from
the documentation online. Wouldn't the ServerAlias be example.net, not
example.com. I setup my apache using this example and if a user types in
example.net without the www in front they don't get the site.  If I change
the ServerAlias to example.net it works now.  I am doing something worry?
Both www.example.com and example.com work, but not example.net with the
redirect.

NameVirtualHost ?

<VirtualHost ?>
  ServerName www.example.net
  ServerAlias example.com    (Why not example.net)
  Redirect permanent / http://www.example.com/
</VirtualHost>

<VirtualHost ?>
  ServerName www.example.com
  DocumentRoot /usr/local/apache/htdocs
</VirtualHost>

Thanks,
Mark.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] The 2003 Con???

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Michael Crawford wrote:
> Any word on the 2003 Con?

planned for november (comdex week) in las vegas again.
-- 
#ken	P-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist      http://Apache-Server.Com/

"Millennium hand and shrimp!"


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] The 2003 Con???

Posted by Michael Crawford <cr...@mun.ca>.
Any word on the 2003 Con?

-- 
Cheers,
        Michael

**************************************************************
Michael Crawford              | Memorial University of
Systems Administrator      | Newfoundland
**************************************************************


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting up Redirect using Apache

Posted by Mark McCulligh <mm...@visualtech.ca>.
If I change the ServerAlias to example.net, instead of example.com it works
fine. But I way just wondering if I was doing something wrong and
ServerAlias was set to example.com for a reason and need to be set to
example.com. I didn't understand why the line was in the example code, if it
was not really needed.

The problem I was having was without the ServerAlias set to example.net the
user ended up at a different web site, the first in my virtual host list.

Thanks for your help Joshua,
Later,
Mark

----- Original Message -----
From: "Joshua Slive" <jo...@slive.ca>
To: <us...@httpd.apache.org>
Sent: Friday, May 09, 2003 10:51 AM
Subject: Re: [users@httpd] Setting up Redirect using Apache


> On Fri, 9 May 2003, Mark McCulligh wrote:
>
> > The problem is that I have more then one site on the server, for it is
goes
> > to the first virtual host it is my site, because I am the first in the
list.
> > I am looking for all example.net and example.com to end to at
example.com.
> > Right now example.com, www.example.com and www.example.net goto
> > www.example.com ok. But example.net without the www ends up at my site
>
> So add the sites to the ServerAlias line (seperated by spaces).  I'm
> having a hard time figuring out what the exact problem here is.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting up Redirect using Apache

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, 9 May 2003, Mark McCulligh wrote:

> The problem is that I have more then one site on the server, for it is goes
> to the first virtual host it is my site, because I am the first in the list.
> I am looking for all example.net and example.com to end to at example.com.
> Right now example.com, www.example.com and www.example.net goto
> www.example.com ok. But example.net without the www ends up at my site

So add the sites to the ServerAlias line (seperated by spaces).  I'm
having a hard time figuring out what the exact problem here is.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting up Redirect using Apache

Posted by Mark McCulligh <mm...@visualtech.ca>.
The problem is that I have more then one site on the server, for it is goes
to the first virtual host it is my site, because I am the first in the list.
I am looking for all example.net and example.com to end to at example.com.
Right now example.com, www.example.com and www.example.net goto
www.example.com ok. But example.net without the www ends up at my site

Thanks,
Mark


----- Original Message -----
From: "Joshua Slive" <jo...@slive.ca>
To: <us...@httpd.apache.org>
Sent: Friday, May 09, 2003 10:39 AM
Subject: Re: [users@httpd] Setting up Redirect using Apache


> On Fri, 9 May 2003, Mark McCulligh wrote:
>
> > I am trying to setup redirection using Apache and below is the example
from
> > the documentation online. Wouldn't the ServerAlias be example.net, not
> > example.com. I setup my apache using this example and if a user types in
> > example.net without the www in front they don't get the site.  If I
change
> > the ServerAlias to example.net it works now.  I am doing something
worry?
> > Both www.example.com and example.com work, but not example.net with the
> > redirect.
>
> You can put whatever you want in there.  The point is that anything
> matched in the first vhost should get redirected to the second vhost.
> Now, because of the order-of-processing rules, it shouldn't really matter
> what is in the ServerAlias line in the first virtual host, since any
> unmatched hostnames should go to the first virtual host anyway.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting up Redirect using Apache

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, 9 May 2003, Mark McCulligh wrote:

> I am trying to setup redirection using Apache and below is the example from
> the documentation online. Wouldn't the ServerAlias be example.net, not
> example.com. I setup my apache using this example and if a user types in
> example.net without the www in front they don't get the site.  If I change
> the ServerAlias to example.net it works now.  I am doing something worry?
> Both www.example.com and example.com work, but not example.net with the
> redirect.

You can put whatever you want in there.  The point is that anything
matched in the first vhost should get redirected to the second vhost.
Now, because of the order-of-processing rules, it shouldn't really matter
what is in the ServerAlias line in the first virtual host, since any
unmatched hostnames should go to the first virtual host anyway.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting up Redirect using Apache

Posted by Jeff Cohen <su...@gej-it.com>.
> NameVirtualHost ?
> 
> <VirtualHost ?>
>   ServerName www.example.net
>   ServerAlias example.com    (Why not example.net)
>   Redirect permanent / http://www.example.com/
> </VirtualHost>

This type of redirection will be good for somebody that wants to redirect 
users to be forwarded from example.com to it's A host record "WWW".
It's very famous to do such thing for most administrators that having 
their companies web sites sitting over a hosting company and the domain 
is forwarded to their records.

I didn't understand myself :-), in most cases the IP address for 
example.com and the IP address for www.example.com will NOT be the same, 
then this Redirection is needed, if a person will type in his 
browser "http://example.com" he'll get nowhere right?
therefore, you need to redirect the public to the right host that servs 
your website which will be "http://www.exmaple.com" (look at the www 
record), this www record, of course would be also specified in the 
example.com DNS Zone.

All the best,
Jeff Cohen

> 
> <VirtualHost ?>
>   ServerName www.example.com
>   DocumentRoot /usr/local/apache/htdocs
> </VirtualHost>
> 
> Thanks,
> Mark.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org