Peter Krejci Peter Krejci - 2 months ago 27
Apache Configuration Question

htaccess mod rewrite and slash after index.php

I have following .htaccess file:

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

but perhaps because of apache update to version 2.4.23 this one stopped working and browser returns message
file not found

I found out, that URL

searches for
directory and not directly in
and therefore it's not working. Putting directly
variable before
doesn't work, it looks like apache thinks, that document root is the one taken from URL.

How can I rewrite it to index.php with whole path put after index.php?

I'm using fcgi and this is my vhost file:

<Directory "/Users/pogo/Development/www">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted

<VirtualHost *:8080>
ServerName dh
ServerAlias *.dh

VirtualDocumentRoot "/Users/pogo/Development/www/%-2.0.%-1/%0/www"
DirectoryIndex index.html index.php
RewriteEngine On

<FilesMatch \.php$>
SetHandler "proxy:unix:/usr/local/var/run/php5/php5-fpm.sock|fcgi://localhost"


You can use this rule:

AcceptPathInfo On
Options +FollowSymLinks
RewriteEngine on

RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

Notice /index.php instead of ./index.php