I am running wamp on Vista (Apache v2.2.11) and also have projects setup so that http://localhost/projectx may be the base directory for projectx. Now, I would like that demands for

http://localhost/projectx/somepage/extra

will rewrite to

http://localhost/projectx/PUBLIC/somepage/extra

To that particular finish I've got a file in C:\wamp\www\projectx\.htacces that's this straightforward:

RewriteEngine On
RewriteBase /projectx
RewriteCond %{REQUEST_URI} !^/PUBLIC
RewriteRule ^(.*)$ /PUBLIC$1 [L]

I can not for that existence of me understand why this does not work. The mistake I am getting is "The asked for URL /PUBLIC wasn't available on this server". Thanks.

UPDATE 25-Marly-2010:

According to Michael's solution I removed the complete path. For whatever reason I additionally required to give a final slash towards the Cond and Rule:

RewriteEngine On
RewriteBase /projectx
RewriteCond %{REQUEST_URI} !^/PUBLIC/
RewriteRule ^(.*)$ PUBLIC/$1 [L]

Try altering this: RewriteRule ^(.*)$ /PUBLIC$1 [L]

For this: RewriteRule ^(.*)$ PUBLIC$1 [L]

It's most likely only the absolute path that's the issue.

You should also alter the $1 to become zero based so RewriteRule ^(.*)$ PUBLIC$ [L]

Ought to be

RewriteEngine On

RewriteBase /projectx

RewriteCond % !^/PUBLIC

RewriteRule ^(.)(PUBLIC)(.)$ /projectx/PUBLIC$3 [L]