Forum Moderators: phranque
Can that be done? The folders all have the same user and permissions. It just happens that one domain's document root points to a subfolder of a different domain... and now I need to access a parent folder from the domain...
RewriteEngine onRewriteCond %{REQUEST_URI} ^/somefolder
RewriteRule (.*) http://www.otherhost.com/$1 [P]
That works great if I try to access http://www.myhost.com/somefolder/file.php
But, if the file has a query string (http://www.myhost.com/somefolder/file.php?foo=bar) it returns a 404 error :(
RewriteEngine on
RewriteRule ^/somefolder/(.*) http://www.otherhost.com/$1 [P,QSA,L]
Although my approach to this problem would be something like this:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^/somefolder/file.php$ /home/blah/otherscript.php [L]
FollowSymLinks is already on... and QSA didn't make a difference as far as the query string goes. The reason why I run it through the Apache proxy is because the script has to be run under the other domain, even though I want to display the output on a different domain.
So a local rewrite won't work (or else I would've just set up manual sym links)...
The weird thing is that everything works when there's no query string present... which tells me there's something wrong in the qs parsing. Apache seems to think that the qs is part of the file name :(
Any other ideas?
Success:
*.*.*.* - - [11/Aug/2004:07:46:57 -0600] "GET /info.php HTTP/1.1" 200 52298 "-" "User-Agent"
Failure:
*.*.*.* - - [11/Aug/2004:07:48:58 -0600] "GET /info.php?foo=bar HTTP/1.1" 404 418 "-" "User-Agent"
Error log
[Wed Aug 11 07:48:58 2004] [error] [client *.*.*.*] File does not exist: /path/to/some/file/info.php?foo=bar
If I hardcode it:
RewriteRule .* http://www.otherhost.com/info.php [P]
http://www.myhost.com/info.php works well...
http://www.myhost.com/info.php?foober=blick does not...
http://www.myhost.com/gaaaah.php (a script that doesn't exist) works well too... redirecting to info.php like it should
RewriteRule ^/([^?]*)(\?.*)?$ http://www.otherhost.com/$1$2 [P,L]