About redirecting while keeping the displayed the URL in browser

Hi there,

I have a unique situation where I have to develop multiple websites, but managed by only 1 Yii MVC folders (or system)

Let the sites be:

domain.com/blue (<-- this is where the /protected folder of Yii resides)

domain.com/red

domain.com/green

The goal that I want to get is that:

if people access domain.com/red/items/one,

the request is processed as if it goes to domain.com/blue/items/one,

but the URL displayed in the visitor browser is still domain.com/red/items/one

I want to only have 1 Yii file system instead of spreading it into each folder to make it easy to maintain.

I have played around with the .htaccess at domain.com/ to have something like:





RewriteRule ^red/(.*)$ /blue/$1 [P]

RewriteRule ^red/(.*)$ /blue/$1    [QSA,E=ORIG_URI:/$1]




The first line with "P" works fine as intended.

However, the $_SERVER returned does not display any "red" in it, so the system cannot distinguish if the page is accessed from "red" instead of "blue"

The second line has the $_SERVER returned with "red" displayed in the REQUEST_URI, however it returns /blue/index instead of /blue/items/one

I have experimented this for over 8 hours, this is getting frustrating.

Can you please advise what the best practice for this be?

Please help.