Re: Apache (was Apace) Redirect Question

2012-11-04 Thread craig
 Here are the settings for one of my multisite servers.

Good afternoon Wolf,

I am afraid I am not accomplishing what I want to do with your information
either. I've tried to get it to work with my layout, but no matter what
I do, entering http://domain1.com in the client's browser either gives
me a 404 if there is nothing explictely defined to serve a request for
http://domain1.com, or if I define a server alias, then the URL never changes
to http://www.domain1.com, but the page is served. This is basically what
I had with my site definitions too.

I did find some old documentation on the Apache site that seems to support
exactly what I want to do, but I am unable to make it work either. Granted
this is for version 2.0, but the regular expressions should be valid. That URL
is http://httpd.apache.org/docs/2.0/misc/rewriteguide.html. The description
under the section labeled Canonical Hostnames reads:

The goal of this rule is to force the use of a particular hostname,
in preference to other hostnames which may be used to reach the same
site. For example, if you wish to force the use of www.example.com instead
of example.com, you might use a variant of the following recipe.

The rewrite rules listed for that recipe are:
   RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
   RewriteCond %{HTTP_HOST}   !^$
   RewriteRule ^/(.*) http://www.example.com/$1 [L,R]

I have placed these rules as global directives in /etc/apache2/apache2.conf,
and they did not work. I tried them in the default site file, and in the
vhost definition for domain1.com. Again, unless I have a line in the file
sites-avaliable/domain1.com that reads ServerAlias domain1.com, the request
for http://domain1.com results in a 404 error. If I place the ServerAlias
line in the file, the page is served, but URL is never rewritten. I have even
created a LogFormat template that captures the host request, and domain1.com
is what is being requested.

It is almost as if the rewrite engine is never made aware of the fact that
the condition it is supposed to be looking for has in fact occurred. I find
it hard to beleive this is a bug that has gone unnoticed for this long, so
I've got to believe it is something I've done wrong. But I have followed the
example exactly as written, and I am familar enough with regular expressions
to know that !^www\.domain1\.com [NC] means a host that does not start with
www.domain1.com, ignoring letter case, and that !^$ means the host request is
not empty. So why does a request for domain1.com, which meets both criteria,
not trigger the rewrite rule?

At this point I am utterly frustrated because the documentation is clear,
but following it fails. I just want to type http://domain1.com into the
address bar, and have Apache change it to http://www.domain1.com. I just do
not know how to accomplish this.


Sent - Gtek Web Mail



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1352072207.864818...@webmail.gtek.biz



Re: Apache (was Apace) Redirect Question

2012-11-04 Thread craig
On Saturday, November 3, 2012 19:38, mouss mo...@ml.netoyen.net said:

 Le 03/11/2012 13:31, cr...@gtek.biz a écrit :

 [snip]
 I know I've entered URL's into my browser's navigation bar and watched them
 change to something else, such as entering http://example.com and being
 redirected to http://www.example.com, with that URL then populating the
 navigation bar. So I'm close in that both requests return the file that I
 want returned, but I don't know how to have the URL change so the user sees
 the URL I want them to see.

 So I guess what I'm asking is, how do I configure things so that the server
 knows a request for domain1.com should be handled as if it were a request for
 www.domain1.com, and sends the client to that URL?

 
 in domain1.com vhost config:
 
 redirect permanent / http://www.domain1.com/
 
 
 source:
   http://httpd.apache.org/docs/2.2/en/mod/mod_alias.html#redirect

Hi mouss,

Unfortunately, if I leave the ServerAlias domain1.com line out of the
sites-available/domain1.com file, all requests for http://domain1.com result
in a 404 error, with or without this redirect. If I put that line in the
file then this redirect results in an error page that states something to
the effect of Icedove has detected that this page is being redirected in
a manner that will never complete.


Sent - Gtek Web Mail



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1352072715.965918...@webmail.gtek.biz



Re: Apache (was Apace) Redirect Question

2012-11-04 Thread Wolf Halton
did you link the sites in sites-available to sites-enabled?

Wolf Halton
http://sourcefreedom.com
Apache developer:
wolfhal...@apache.org
On Nov 4, 2012 6:45 PM, cr...@gtek.biz wrote:

 On Saturday, November 3, 2012 19:38, mouss mo...@ml.netoyen.net said:

  Le 03/11/2012 13:31, cr...@gtek.biz a écrit :
 
  [snip]
  I know I've entered URL's into my browser's navigation bar and watched
 them
  change to something else, such as entering http://example.com and being
  redirected to http://www.example.com, with that URL then populating the
  navigation bar. So I'm close in that both requests return the file that
 I
  want returned, but I don't know how to have the URL change so the user
 sees
  the URL I want them to see.
 
  So I guess what I'm asking is, how do I configure things so that the
 server
  knows a request for domain1.com should be handled as if it were a
 request for
  www.domain1.com, and sends the client to that URL?
 
 
  in domain1.com vhost config:
 
  redirect permanent / http://www.domain1.com/
 
 
  source:
http://httpd.apache.org/docs/2.2/en/mod/mod_alias.html#redirect

 Hi mouss,

 Unfortunately, if I leave the ServerAlias domain1.com line out of the
 sites-available/domain1.com file, all requests for http://domain1.comresult
 in a 404 error, with or without this redirect. If I put that line in the
 file then this redirect results in an error page that states something to
 the effect of Icedove has detected that this page is being redirected in
 a manner that will never complete.


 Sent - Gtek Web Mail



 --
 To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
 with a subject of unsubscribe. Trouble? Contact
 listmas...@lists.debian.org
 Archive: http://lists.debian.org/1352072715.965918...@webmail.gtek.biz




Re: Apache (was Apace) Redirect Question

2012-11-04 Thread craig
 did you link the sites in sites-available to sites-enabled?
 
 Wolf Halton
 http://sourcefreedom.com
 Apache developer:
 wolfhal...@apache.org

$ ls -l /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 26 Oct 14 16:58 000-default - ../sites-available/default
lrwxrwxrwx 1 root root 34 Oct 14 18:08 domain1.com - 
../sites-available/domain1.com
lrwxrwxrwx 1 root root 34 Oct 14 18:42 domain2.com - 
../sites-available/domain2.com

I I recall using a2ensite for the sites, and a2enmod to enable the rewrite
module. That is the only module I've had to enable. Sure would have been
nice if it had only been missing links though.


Sent - Gtek Web Mail



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1352080651.246218...@webmail.gtek.biz



Re: Apache (was Apace) Redirect Question

2012-11-03 Thread craig


On Friday, November 2, 2012 21:48, Wolf Halton wolf.hal...@gmail.com said:

 Make these changes in sites-available files. That is what those files in
 there are for.
 I don't have the specific directive but I can put up one of my servers'
 apache files for you.
 
 Wolf Halton
 http://sourcefreedom.com
 Apache developer:
 wolfhal...@apache.org

Thanks Wolf, and it makes sense that the directives that apply to a site would
go in that site's definition. I just don't quite understand what I need to put
in there. When I check the default site access logs, I see the request for
http://domain1.com come in as /, but I also see the same for domain2.com and
for the IP address. All three show up as GET / HTTP/1.1 I understand that the
server does not know about the sites by those names because I haven't 
configured it to do so.

Obviously Apache is capable of this distinction because if I change the
ServerName in domain1's sites-available to domain1.com then the index.html file
in /var/www/htdocs/domain1.com is returned to the client. If I add the 
ServerAlias www.domain1.com directive then both the request for domain1.com and 
the request for www.domain1.com return /var/www/htdocs/domain1.com/index.html,
but the URL does not change in the navigation bar, and both show up in the log 
as GET / HTTP/1.1.

I know I've entered URL's into my browser's navigation bar and watched them
change to something else, such as entering http://example.com and being
redirected to http://www.example.com, with that URL then populating the
navigation bar. So I'm close in that both requests return the file that I
want returned, but I don't know how to have the URL change so the user sees
the URL I want them to see.

So I guess what I'm asking is, how do I configure things so that the server
knows a request for domain1.com should be handled as if it were a request for
www.domain1.com, and sends the client to that URL?

Thanks,
Craig


Sent - Gtek Web Mail



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1351945905.66525...@webmail.gtek.biz



Re: Apache (was Apace) Redirect Question

2012-11-03 Thread Wolf Halton
On Sat, Nov 3, 2012 at 8:31 AM,  cr...@gtek.biz wrote:


 On Friday, November 2, 2012 21:48, Wolf Halton wolf.hal...@gmail.com said:

 Make these changes in sites-available files. That is what those files in
 there are for.
 I don't have the specific directive but I can put up one of my servers'
 apache files for you.

 Wolf Halton
 http://sourcefreedom.com
 Apache developer:
 wolfhal...@apache.org

 Thanks Wolf, and it makes sense that the directives that apply to a site would
 go in that site's definition. I just don't quite understand what I need to put
 in there. When I check the default site access logs, I see the request for
 http://domain1.com come in as /, but I also see the same for domain2.com and
 for the IP address. All three show up as GET / HTTP/1.1 I understand that 
 the
 server does not know about the sites by those names because I haven't
 configured it to do so.

 Obviously Apache is capable of this distinction because if I change the
 ServerName in domain1's sites-available to domain1.com then the index.html 
 file
 in /var/www/htdocs/domain1.com is returned to the client. If I add the
 ServerAlias www.domain1.com directive then both the request for domain1.com 
 and
 the request for www.domain1.com return /var/www/htdocs/domain1.com/index.html,
 but the URL does not change in the navigation bar, and both show up in the log
 as GET / HTTP/1.1.

 I know I've entered URL's into my browser's navigation bar and watched them
 change to something else, such as entering http://example.com and being
 redirected to http://www.example.com, with that URL then populating the
 navigation bar. So I'm close in that both requests return the file that I
 want returned, but I don't know how to have the URL change so the user sees
 the URL I want them to see.

 So I guess what I'm asking is, how do I configure things so that the server
 knows a request for domain1.com should be handled as if it were a request for
 www.domain1.com, and sends the client to that URL?

 Thanks,
 Craig


 Sent - Gtek Web Mail



Here are the settings for one of my multisite servers.
I am using Apache2.2 on Debian Squeeze with the backports repo enabled
- thus it is not a stock Squeeze install
This is even simpler than I thought I would be giving you as the
NameVirtualHost directive is in conf.d/virtual.conf
If you notice, the apache2.conf file has only the generic server info
and all of the specific user configs are in other places.
It handles the did they type www. or not in the virtual config as a
server alias.  This is not a redirect, which would add details to the
url, like you get when you type http://evergreen.lyrasistechnology.org
into the address bar, because these 2 directories are simply not
shared.
The evergreen address is pointed at a directory outside of /var/www
and can be shared by multiple clients and the search scope is
different in each.
** You may get a warning when you restart apache with this setup
because default-ssl is listening on port 443 - the complaint will be
that apache does not like mixing virtual servers with port numbers and
others without.  I haven't had to restart this setup for months, so I
don't remember the exact warning message.

-Wolf


#===snippet from apache2.conf

# Include generic snippets of statements
Include conf.d/



#===Contents of conf.d directory===
wolf@SERVER-01:/etc/apache2/conf.d$ ls
charset  localized-error-pages  other-vhosts-access-log  security  virtual.conf


#===Configuration of virtual.conf===

wolf@SERVER-01:/etc/apache2/conf.d$ cat virtual.conf
# running virtual hosts
#
NameVirtualHost *

#==Contents of the sites-available directory

wolf@SERVER-01:/etc/apache2/sites-available$ ls
default  default-ssl  legacy

#==Configuration for dev.example.net

wolf@SERVER-01:/etc/apache2/sites-available$ cat default
VirtualHost *
ServerAdmin wolf.hal...@lyrasis.org
ServerName dev.example.net
ServerAlias www.dev.example.net

DocumentRoot /var/www/http/
Directory /
Options FollowSymLinks
AllowOverride All
/Directory
Directory /var/www/http/
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
/Directory

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
Directory /usr/lib/cgi-bin
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
/Directory

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ /usr/share/doc/
Directory /usr/share/doc/
Options Indexes MultiViews 

Re: Apache (was Apace) Redirect Question

2012-11-03 Thread craig
Wolf, thank you very much for graciously providing the examples. I will
study this to gain an understanding, and I will let you know how it goes.

Craig

 Here are the settings for one of my multisite servers.
 I am using Apache2.2 on Debian Squeeze with the backports repo enabled
 - thus it is not a stock Squeeze install
 This is even simpler than I thought I would be giving you as the
 NameVirtualHost directive is in conf.d/virtual.conf
 If you notice, the apache2.conf file has only the generic server info
 and all of the specific user configs are in other places.
 It handles the did they type www. or not in the virtual config as a
 server alias.  This is not a redirect, which would add details to the
 url, like you get when you type http://evergreen.lyrasistechnology.org
 into the address bar, because these 2 directories are simply not
 shared.
 The evergreen address is pointed at a directory outside of /var/www
 and can be shared by multiple clients and the search scope is
 different in each.
 ** You may get a warning when you restart apache with this setup
 because default-ssl is listening on port 443 - the complaint will be
 that apache does not like mixing virtual servers with port numbers and
 others without.  I haven't had to restart this setup for months, so I
 don't remember the exact warning message.
 
 -Wolf
 
 
 #===snippet from apache2.conf
 
 # Include generic snippets of statements
 Include conf.d/
 
 
 
 #===Contents of conf.d directory===
 wolf@SERVER-01:/etc/apache2/conf.d$ ls
 charset  localized-error-pages  other-vhosts-access-log  security  
 virtual.conf
 
 
 #===Configuration of virtual.conf===
 
 wolf@SERVER-01:/etc/apache2/conf.d$ cat virtual.conf
 # running virtual hosts
 #
 NameVirtualHost *
 
 #==Contents of the sites-available directory
 
 wolf@SERVER-01:/etc/apache2/sites-available$ ls
 default  default-ssl  legacy
 
 #==Configuration for dev.example.net
 
 wolf@SERVER-01:/etc/apache2/sites-available$ cat default
 VirtualHost *
   ServerAdmin wolf.hal...@lyrasis.org
   ServerName dev.example.net
   ServerAlias www.dev.example.net
 
   DocumentRoot /var/www/http/
   Directory /
   Options FollowSymLinks
   AllowOverride All
   /Directory
   Directory /var/www/http/
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order allow,deny
   allow from all
   /Directory
 
   ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
   Directory /usr/lib/cgi-bin
   AllowOverride None
   Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Order allow,deny
   Allow from all
   /Directory
 
   ErrorLog /var/log/apache2/error.log
 
   # Possible values include: debug, info, notice, warn, error, crit,
   # alert, emerg.
   LogLevel warn
 
   CustomLog /var/log/apache2/access.log combined
 
 Alias /doc/ /usr/share/doc/
 Directory /usr/share/doc/
 Options Indexes MultiViews FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all
 Allow from 127.0.0.0/255.0.0.0 ::1/128
 /Directory
 
 /VirtualHost
 
 #Configuration for legacy.example.net==
 wolf@SERVER-01:/etc/apache2/sites-available$ cat legacy
 # This is the settings file for the legacy.example.net site
 
 VirtualHost *
 ServerAdmin wolf.hal...@lyrasis.org
 ServerName  www.legacy.example.net
 ServerAlias legacy.example.net
 
 # Indexes + Directory Root.
 DirectoryIndex index.html
 DocumentRoot /var/www/legacy/htdocs/
 
 # CGI Directory
 ScriptAlias /cgi-bin/ /var/www/legacy/cgi-bin/
 Location /cgi-bin
 Options +ExecCGI
 /Location
 
 
 # Logfiles
 ErrorLog  /var/www/legacy/logs/error.log
 CustomLog /var/www/legacy/logs/access.log combined
 /VirtualHost
 
 
 --
 This Apt Has Super Cow Powers - http://sourcefreedom.com
 Open-Source Software in Libraries - http://FOSS4Lib.org
 Advancing Libraries Together - http://LYRASIS.org
 Apache Open Office Developer wolfhal...@apache.org
 
 
 --
 To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
 with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
 Archive:
 http://lists.debian.org/CALRLYEmYvqzFFSidNhv5V+ka0YQr7A-6FK3u-=s0aph1-0k...@mail.gmail.com
 
 



Sent - Gtek Web Mail



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1351976583.48636...@webmail.gtek.biz



Re: Apache (was Apace) Redirect Question

2012-11-03 Thread mouss
Le 03/11/2012 13:31, cr...@gtek.biz a écrit :
 
 [snip]
 I know I've entered URL's into my browser's navigation bar and watched them
 change to something else, such as entering http://example.com and being
 redirected to http://www.example.com, with that URL then populating the
 navigation bar. So I'm close in that both requests return the file that I
 want returned, but I don't know how to have the URL change so the user sees
 the URL I want them to see.
 
 So I guess what I'm asking is, how do I configure things so that the server
 knows a request for domain1.com should be handled as if it were a request for
 www.domain1.com, and sends the client to that URL?
 

in domain1.com vhost config:

redirect permanent / http://www.domain1.com/


source:
http://httpd.apache.org/docs/2.2/en/mod/mod_alias.html#redirect


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/5095b8ec.3080...@ml.netoyen.net