httpd-users-de mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Kohlbecker <kohlbec...@web.de>
Subject per-server mod_rewrite und VirtualHosts
Date Thu, 26 Jan 2006 14:37:43 GMT
Hallo,

wir haben auf einem Windows 2003 Server Apache 2.0.55 laufen.
konfiguriert wird der Apache nur über die httpd.conf Datei (keine
.htaccess) in der einige VirtualHosts definiert sind. Beim Versuch
per-server (globale) RewriteRules zu definieren ergab sich folgendes
Problem:

Die per-server RewriteRules werden ignoriert wenn ein VirtualHost
angegeben ist. Ohne VirtualHosts funktioniert alles erwartungsgemäss.
Ist dies eine normales verhalten? Vielleicht habe ich was übersehen?

Hier ist unsere httpd.conf-Datei, aus der ich möglichst wenig 
herausgekürzt habe da ich wirklich nicht weis wo der Fehler liegt!

Schonmal Danke in vorraus für Eure Hilfe.

//////////////////////////////////////////////////////////////////
ServerRoot "C:/Program Files/Apache Group/Apache2"
PidFile logs/httpd.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule mpm_winnt.c>
   ThreadsPerChild 250
   MaxRequestsPerChild  0
</IfModule>

Listen 172.123.4.56:80

# Dynamic Shared Object (DSO) Support
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_module modules/mod_auth.so
#LoadModule auth_anon_module modules/mod_auth_anon.so
#LoadModule auth_dbm_module modules/mod_auth_dbm.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
##LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
# ------------- LoadModule jk_module  modules/mod_jk.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so
##LoadModule imap_module modules/mod_imap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
##LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so

<IfModule mod_jk.c>
	# -------------- Jakarta Tomcat Connector ---------------
	# Where to find workers.properties fpr the Jakarta Tomcat Connector
	JkWorkersFile conf/workers.properties
	# Where to put jk logs
	JkLogFile     E:/Temp/Apache/logs/mod_jk.log
	# Set the jk log level [debug/error/info]
	JkLogLevel    info
	# Select the log format
	JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
	# JkOptions indicate to send SSL KEY SIZE,
	JkOptions  +ForwardKeySize +ForwardURICompat -ForwardDirectories
	# JkRequestLogFormat set the request format
	JkRequestLogFormat     "%w %V %T"
	# Send all *.jsp for a given context to worker named ajp13w (ajp13)
	JkMount  /*.jsp ajp13w
	# jkMount path for the ResourcesServlet
	JkMount  /Resource/*  ajp13w
	
	JkMount  /*/attach* ajp13w
	JkMount  /*/Wiki/* ajp13w
	
	JkMount /Workbench/Help/  ajp13w
	JkMount /Workbench/Help  ajp13w
	
	JkMount /Workbench/Portal/  ajp13w
	JkMount /Workbench/Portal  ajp13w
</ifModule>

### Section 2: 'Main' server configuration

ServerName 172.123.4.56

UseCanonicalName Off
DocumentRoot "D:/Campus"

<Directory />
     Options FollowSymLinks
     AllowOverride None
     Order deny,allow
     Deny from All

     # redirect ASPX and ColdFusion-Files to the IIS on port 8080
     RedirectMatch (.*)\.(cfm|aspx)$ http://172.123.4.56:8080$1.$2
</Directory>

<Directory "D:/Campus">
	Options FollowSymLinks
	AllowOverride None
	Order allow,deny
	Allow from all
</Directory>

<Directory ~ "/WEB-INF">
     Order allow,deny
     Deny from all
</Directory>

<Directory ~ "/_[a-z,A-Z]">
     Order allow,deny
     Deny from all
</Directory>

DirectoryIndex index.html index.jsp index.html.var

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
     Order allow,deny
     Deny from all
</Files>

# prevent some filetypes from beeing sent to clients
# ASPX Files, ColdFusion Files  will be redirected to the IIS on port 8080

<Files "*.properties">
     Order allow,deny
     Deny from all
</Files>
<Files "*.class">
     Order allow,deny
     Deny from all
</Files>
<Files "*.java">
     Order allow,deny
     Deny from all
</Files>

TypesConfig conf/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
     MIMEMagicFile conf/magic
</IfModule>

HostnameLookups Off

ErrorLog E:/Temp/Apache/logs/error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" 
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog E:/Temp/Apache/logs/access.log common

# RewriteLog
<IfModule mod_rewrite.c>
     RewriteLog E:/Temp/Apache/logs/rewrite.log
     RewriteLogLevel 5
</IfModule>

ServerTokens Full
ServerSignature On

#
# URL Rewriting
#

RewriteEngine  on
RewriteCond    %{REQUEST_FILENAME}  -d
RewriteRule    ^(.+[^/])$           $1/  [R]

Alias /icons/ "C:/Program Files/Apache Group/Apache2/icons/"

<Directory "C:/Program Files/Apache Group/Apache2/icons">
     Options Indexes MultiViews
     AllowOverride None
     Order allow,deny
     Allow from all
</Directory>

AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|ru))?(/.*)?$ "C:/Program 
Files/Apache Group/Apache2/manual$1"

<Directory "C:/Program Files/Apache Group/Apache2/manual">
     Options Indexes
     AllowOverride None
     Order allow,deny
     Allow from all

     <Files *.html>
         SetHandler type-map
     </Files>

     SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/ 
prefer-language=$1
     RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$ 
/manual/$1$2
</Directory>


# -------------------- Alias to the Tomcat5 documentation
Alias /tomcat5/ "C:/Program Files/Apache Software Foundation/Tomcat 
5.5/webapps/tomcat-docs/"
<Directory "C:/Program Files/Apache Software Foundation/Tomcat 
5.5/webapps/tomcat-docs">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
</Directory>

# -------------------- Alias to the JSP Wikis:
# note: Alias both end with slash, Directory: no slash at end!

# Use the mod_jk JkAutoAlias (Apache 1.3 only) directive to map all web 
application context directories into Apache's document space.
<IfModule mod_jk.c>
JkAutoAlias "D:/Campus/Wiki/"
</IfModule>

Alias /Workbench/Portal/        "D:/Campus/Wiki/JSPWiki/"
Alias /workbench/portal/        "D:/Campus/Wiki/JSPWiki/"
Alias /WorkBench/Portal/        "D:/Campus/Wiki/JSPWiki/"


<Directory "D:/Campus/Wiki/JSPWiki">
	AllowOverride None
	Options None FollowSymlinks
	Order allow,deny
	Allow from all
</Directory>

AddLanguage de .de
AddLanguage en .en
AddLanguage es .es
AddLanguage fr .fr
AddLanguage it .it
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn 
no pl pt pt-BR ru sv zh-CN zh-TW
ForceLanguagePriority Prefer Fallback

#
AddCharset ISO-8859-1  .iso8859-1 .latin1
AddCharset ISO-8859-2  .iso8859-2 .latin2 .cen
AddCharset ISO-8859-3  .iso8859-3 .latin3
AddCharset ISO-8859-4  .iso8859-4 .latin4
AddCharset ISO-8859-5  .iso8859-5 .latin5 .cyr .iso-ru
AddCharset ISO-8859-6  .iso8859-6 .latin6 .arb
AddCharset ISO-8859-7  .iso8859-7 .latin7 .grk
AddCharset ISO-8859-8  .iso8859-8 .latin8 .heb
AddCharset ISO-8859-9  .iso8859-9 .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5        .Big5       .big5
# For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251   .win-1251
AddCharset CP866       .cp866
AddCharset KOI8-r      .koi8-r .koi8-ru
AddCharset KOI8-ru     .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8       .utf8

AddCharset GB2312      .gb2312 .gb
AddCharset utf-7       .utf7
AddCharset utf-8       .utf8
AddCharset big5        .big5 .b5
AddCharset EUC-TW      .euc-tw
AddCharset EUC-JP      .euc-jp
AddCharset EUC-KR      .euc-kr
AddCharset shift_jis   .sjis

#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
<IfModule php4apache2.c>
     AddType application/x-httpd-php .php
</ifModule>

#
AddHandler type-map var
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

BrowserMatch "Microsoft Data Access Internet Publishing Provider" 
redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully

<IfModule mod_ssl.c>
     Include conf/ssl.conf
</IfModule>


### Section 3: Virtual Hosts
NameVirtualHost *:80

# ohne diesen VirtualHost funktioniert per-server rewriting !!!!
##############################
<VirtualHost 172.123.4.56:80>
  ServerName www.Campus.net
  ServerAlias Campus.net *.Campus.net
  DocumentRoot "D:/Campus"
  DirectoryIndex index.html index.jsp
</VirtualHost>
##############################
//////////////////////////////////////////////////////////////////


Grüße
Andreas



--------------------------------------------------------------------------
                Apache HTTP Server Mailing List "users-de" 
      unsubscribe-Anfragen an users-de-unsubscribe@httpd.apache.org
           sonstige Anfragen an users-de-help@httpd.apache.org
--------------------------------------------------------------------------


Mime
View raw message