Apache: Virtuelle Host und URL-Rewriting innerhalb httpd.conf für Kohana Framework

Ich bin mit dem Kohana Framework 3.x. Mein Webserver ist Apache und ich mit Virtual Hosts, weil ich mehr als ein websites, die mit meinem Server.

Meine httpd.conf sieht wie folgt aus:

  <VirtualHost *:80>
 ServerName www.myPage1.com
 ServerAlias myPage1.com
 DocumentRoot /var/www/myPage1
</VirtualHost>
<VirtualHost *:80>
 ServerName www.myPage2.com
 ServerAlias myPage2.de
 DocumentRoot /var/www/myPage2
</VirtualHost>

In Kohana jeder http-request muss gehen, um die index.php erste. Weil ich nicht wie diese hässliche URLs, die beginnt mit index.php (zum Beispiel www.myPage1.com/index.php/item/detail/itemId) ich habe die folgenden .htaccess-Datei, die funktioniert perfekt

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

Nun möchte ich nicht verwenden .htaccess-Datei mehr, und stattdessen setzen alle der rewrite-Logik in meine httpd.conf-Datei. Das folgende gibt mir ein "400 Bad Request"

<VirtualHost *:80>
 RewriteEngine On
 <Files .*>
  Order Deny,Allow
  Deny From All
 </Files>
 RewriteRule ^(?:aplication|modules|system)\b.* index.php/$0 [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule .* index.php/$0 [PT]

 ServerName www.myPage2.com
 ServerAlias myPage2.com
 DocumentRoot /var/www/myPage2
</VirtualHost>

Was mache ich falsch? Hilfe würde geschätzt!

InformationsquelleAutor Pascal Klein | 2010-11-30
Schreibe einen Kommentar