I'm using the Kohana Framework 3.x. My Webserver is Apache and I use Virtual Hosts, because I manage more than one websites with my Server.
My httpd.conf looks like this:
<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 every http request needs to go to the index.php first. Because I dont like these ugly URLs that all starts with index.php (for example www.myPage1.com/index.php/item/detail/itemId) I used the following .htaccess file which worked perfectly
# 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]
I would now like to not use a .htaccess file anymore and instead put all the rewrite logic into my httpd.conf file. The following gives me a "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>
What am I doing wrong? Help would be appreciated!
You don't have a RewriteBase in your httpd.conf. And what's wrong with the .htaccess?