Utilize Apache's mod_proxy configurations
Many Website Host providers provides the ability to use Apache's mod_proxy module , which can be set up with a custom mod_proxy configuration. However, using a custom configuration means that any changes will need to go through a more structured review process. You can also use
mod_rewrite
rules in your .htaccess
file with the [P]
or proxy flag. This is the simplest method of setting up a proxy, and keeps any necessary changes in your hands. Customers should contact Support to enable the generic mod_proxy
configuration.
For more information about the
[P]
flag, see Introduction to htaccess rewrite rules.
Acquia's generic proxy configuration is similar to the following:
#generic mod_proxy config. Installed by puppet httpd::mod_proxy
#Intended for use with mod_rewrite directives loaded in customer's
#.htaccess files using the [P] flag.
#Reference: https://httpd.apache.org/docs/current/rewrite/proxy.html
#no anon proxy requests
ProxyRequests Off
AddDefaultCharset off
Order deny,allow
Allow from all
In your
.htaccess
file, the following example causes any path starting with /blogs
to be served from myblog.example.com
, but to still use the www.example.com/blogs/
URL.RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blogs/
RewriteRule ^blogs/(.*) http://myblog.example.com/$1 [P,L]
Utilizing a reverse proxy server allows the URL
http://myblog.example.com/fantastic-ideas
to be accessible from http://www.example.com/blogs/fantastic-ideas
.
No comments:
Post a Comment