.htaccess send requests to a subfolder's index.php

Posted by mediaslave on Server Fault See other posts from Server Fault or by mediaslave
Published on 2010-03-11T09:06:52Z Indexed on 2010/03/11 18:35 UTC
Read the original article Hit count: 273

Filed under:
|
|

I have searched stackoverflow for my answer, but nothing that I have seen seems to work.

I have a framework that sends all requests to an index.php file. Everything works when I install it in the root of the virtual host:

http://domain/
http://domain/home
http://domain/home/index

The problem happens when I try to install the framework in a subdirectory like:

http://domain/blog/

Requests like:

http://domain/blog/home
http://domain/blog/home/index

All of those requests should be sent to the index.php file that lives in /blog

My current set up is:

http://domain/index.php - This file just prints out 'we are in the root of the virtual host' The framework is not installed there.

http://domain/blog - This works fine

When I try to got to http://domain/blog/home I get the roots index.php file not the frameworks. I get the message 'we are in the root of the virtual host'.

I have the following .htaccess file located at http://domain/blog/.htaccess

RewriteEngine on

Options Indexes FollowSymLinks -MultiViews

RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

Any help is greatly appreciated.

Regards,

Justin

© Server Fault or respective owner

Related posts about .htaccess

Related posts about mod-rewrite