Apache Configuration - ProxyPass/Reverse with Rewrites
$5-10 USD
In Progress
Posted almost 15 years ago
$5-10 USD
Paid on delivery
I have a website that uses rewrite rules.? I want to proxy requests to a sub-folder in this site ([login to view URL]) to another site (<[login to view URL]>) which also has rewrite rules (typical wordpress rewrite rules).
The problem I am running into is that the ProxyPass and ProxyPassReverse directives do not seem to work (the client gets redirected to [login to view URL] - or at least that's the URL that gets shown).? I think I need to use the [P] directive with the rewrite rules, but I'm not sure where this needs to be done.
Thank you for your help,
John
## Deliverables
I am using Apache 2.0 web server.
rewrite rules are in .htaccess files in website directories.?
in [login to view URL] file there is the following in a virtualhost:
ProxyPass /blog/ [login to view URL]
ProxyPassReverse /blog/ [login to view URL]
and the user who requests <[login to view URL]> gets redirected to [login to view URL]
whereas I want the user to stay at <[login to view URL]> but get all contect proxied (and reverse proxied) from [login to view URL]
Here is .htaccess file for example1:
RewriteEngine On
RewriteBase /
# If www+subdomain domain requested, externally redirect to subdomain without "www"
rewriteCond %{HTTP_HOST} ^www\.example1\.com
rewriteRule (.*) [login to view URL]$1 [R=301,L]
#only use rewrite if the file being called does not exist!!!
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*) [login to view URL]$1 [L,NE]
RewriteRule ^(.*) [login to view URL]$1 [L,NE,QSA]
Here is .htaccess for [login to view URL]:
RewriteEngine On
RewriteBase /blogs/
#uploaded files
RewriteRule ^(.*/)?files/$ [login to view URL] [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/[login to view URL]$2 [L]
# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . [login to view URL] [L]
<IfModule mod_security.c>
<Files [login to view URL]>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>