I would like to send requests for
foo.com -> foo.com/dispatch.fcgi
and requests for a subdomain
bar.foo.com -> foo.com/bar
I have this in my .htaccess file;
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteBase /
# if request matches this (NC - make all req lower case)
RewriteCond %{HTTP_HOST} ^bar\.foo\.com$ [NC]
# then redirect here
RewriteRule ^(.*)$ http://foo.com/bar/$1
# if request isn't to the bar URI
RewriteCond %{REQUEST_URI} !^/bar/ [NC]
# and it isn't a file name (? guessing here)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
with this my fcgi
script is working fine, but every attempt to access bar.foo.com
results in a 302 response
302 Found
The document has moved here (http://bar.foo.com).
I'm pretty sure that it's my ReWriteRule
for bar.foo.com
that's mucking things up, but I can't work out how to fix it (and preserve the fcgi route).