Implied python preprocessor to intercept all paths at root?

Ok: I know that many sites have a structure of:

example.com/index.php/pseudodir/pseudofile

Obviously AcceptPathInfo needs to be enabled in order for index.php to be able to make sense of any of it…

But is it possible for me to have / transparently represent index.php so that example.com/pseudodir/file would pass pseudodir to the real file /index.php

?

Thanks

Answer

You’ll need to use mod_rewrite in order to do this; HTTPd adheres to the filesystem structure too tightly.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*)$ index.php/$1 [L]

Attribution
Source : Link , Question Author : Pete , Answer Author : Ignacio Vazquez-Abrams

Leave a Comment