views:

72

answers:

1

Hi there,

I hope I will find a help here. I have a quite complex MVC driven application.

Here how it works:

these are my directories

  1. / - (/dispatcher.php as mvc1 app bootstrap)
  2. /mvc2 - (/mvc2/dispatcher.php as mvc2 app bootstrap)
  3. /mvc3 - (/mvc3/dispatcher.php as mvc3 app bootstrap)

all 3 are accesible under one domain example.com then

  1. example.com/ - is 1st MVC application
  2. example.com/mvc2 - is 2nd application
  3. example.com/mvc3 is a 3rd application.

So far everything is working nicely on .htaccess files (in each mvc folder) which have following code inside:

RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|htc|swf|html|xml)$ dispatcher.php

code is correct my problem is that I would like to move it into vhost.conf file or httpd.conf which is loaded into memory at Apache startup and get rid of all .httaccess to boost up Apache performance.

the current solutions its working correctly because each .htaccess is overwritting its parent directory one, which I can't have to working in vhost.conf

So far I have tried to move it into directive but without success. Any ideas ?

many thanks for help.

cheers

A: 

Try this rule:

RewriteEngine on
RewriteCond %{REQUEST_URI} !.*\.(js|ico|gif|jpg|png|css|htc|swf|html|xml)$
RewriteRule ^(/mvc2|/mvc3)?/ $1/dispatcher.php

That should redirect requests of /mvc2/… or /mvc3/… to the corresponding dispatcher.php. And only if the URL path does start with neither /mvc2/… nor /mvc3/… it’s redirected to the dispatcher.php in the root directory.

Gumbo
Its awesome, works excellent, thank you very much.
Marcin