[clug-talk] Apache and mod_rewrite tips?
sgrover at open2space.com
Mon Mar 14 17:08:43 PST 2005
I have an Apache 2 server setup with a virtual host acting as a proxy to an
internal server. The vhost works fine, but the site in question uses
absolute URLs in dynamically generated pages. So, I'll need mod_rewrite to
help make this work properly. Unfortunately I haven't (yet) found the right
resource that makes this work for me... (spent a few hours today googling and
trying to get this working...). The results I'm looking for is to be able to
access the application internally or externally, and have all URLs resolve
properly. If this means I have to send all the internal requests through the
virtual host, that's fine....
Here's the details (names have been changed to protect the innocent...):
Server Name: myserver
Site Directory: myapp
URL to application (from internal network):
External site info:
Server Name: extapp.myorg.com
Site Directory: (none - root directory)
URL to application (from Internet):
So, I need to change all instances of "myserver/myapp" to extapp.myorg.com".
Thus far, I've yet to see an anchor tag's HREF change.
I've tried a number of rewrite rules, but most revolving around something like
RewriteRule ^myserver/myapp(.*) extapp.myorg.com$1 [L]
RewriteRule ^/myapp/ http://extapp.myorg.com/ [L]
(my lack of skill with regular expressions is probably apparent... <grins>)
I have also tried using the R flag and the P flag.
Any tips? I suspect that either my rules are completely wrong, or maybe
mod_rewrite isn't working properly (but I'm not getting errors when I restart
the web service...) Thanks for any help.
More information about the clug-talk