Forum Moderators: phranque
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteCond %{HTTP_HOST} ^(.*)dev\.example\.edu$ [NC]
RewriteRule ^/recreation(.*)$ http://dev.example.edu/ee1/index.php/recreation$1 [P,NC]
RewriteRule ^/distribution(.*)$ http://dev.example.edu/distribution/index.php/distribution$1 [P,NC]
</IfModule>
the “recreation” rule has been working fine for months. i’m trying to get the second one, “distribution”, to work.
the error i am getting within the browser window is this:
Bad Request
Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit.
X-Forwarded-Host: dev.example.edu, dev.example.edu, dev.example.edu, dev.example.edu, dev.example.edu, dev.example.edu, dev.example.edu, dev.example.edu, dev.example.edu, dev.example.edu, dev.example.edu
i suspect that it's because of the dual reference to "distribution" and thus it's looping. am i correct? how can i fix this? though i have it working for "recreation" which contains "recreation" in both parts of the rule... so i'm not really sure what's going on.
many thanks!
It might also be relevant to describe why you've got a wild-card prepended to the subdomain pattern.
Jim
if something is there that isn't required, then it's probably out of ignorance. i probably copied it from an online example somewhere.
the GUI check box for "enable reverse proxy" is off. what about the config or error is telling you that it is on? the P flag? i can probably remove it then.
i'm just trying to hide the "index.php/distribution" part...
so that:
[dev.example.edu...]
looks like:
[dev.example.edu...]
thanks!
The [P] flag invokes a reverse-proxy request to the server at the designated URL; That is, it opens a new out-going HTTP connection and sends a request to that server. So at the very least, your configuration is twice as slow as it should be, just using the original working rule, because your server is sending itself a new request via HTTP instead of just serving the content from a non-default-mapped filepath.
It seems to me that all that's needed is an internal rewrite, so that requests for the resource at URL
http://dev.example.edu/distribution/<whatever> are served with the content generated by the script at the server filepath <DocumentRoot>/distribution/index.php/distribution/<whatever>
RewriteEngine on
#
# Return 403-Forbidden response to TRACE requests
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
#
# Internally rewrite requests for URL-path /recreation/<anything>
# to filepath /eel/index.php/recreation/<anything>
RewriteCond %{HTTP_HOST} ^dev\.example\.edu [NC]
RewriteRule ^/recreation/(.*)$ /ee1/index.php/recreation/$1 [L]
#
# Internally rewrite requests for URL-path /distribution/<anything>
# to filepath /distribution/index.php/distribution/<anything>
RewriteCond %{HTTP_HOST} ^dev\.example\.edu [NC]
RewriteRule ^/distribution/(.*)$ /distribution/index.php/distribution/$1 [L]