Reputation: 8484
I'm trying a simple thing: Make Apache 2.2.15 respond to all requests to http://myserver/myfolder/*
with http://myserver/myfolder/myproject/*
(Except those to myproject
)
So far I've tried placing several variants of the following .htaccess
on myfolder
:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^myproject
RewriteRule ^(.*)$ myproject/$1 [L]
why do I get a 500 internal error?
Upvotes: 2
Views: 375
Reputation: 785246
Can you try this code:
RewriteBase /myfolder/
RewriteRule ^((?!myproject/).*)$ myproject/$1 [L,NC]
Upvotes: 2
Reputation: 143906
Your condition is failing:
RewriteCond %{REQUEST_URI} !^myproject
All %{REQUEST_URI}
vars have a leading slash.
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/myproject
RewriteRule ^(.*)$ myproject/$1 [L]
Or if the myproject can be anywhere:
RewriteEngine On
RewriteCond %{REQUEST_URI} !/myproject
RewriteRule ^(.*)$ myproject/$1 [L]
If the htaccess file is in the /myfolder
directory then try:
RewriteEngine On
RewriteBase /myfolder/
RewriteCond %{REQUEST_URI} !^/myfolder/myproject
RewriteRule ^(.*)$ myproject/$1 [L]
Upvotes: 1