: Can't get Rewrite rule to keep original URL I have these Rewrites, but I would like to have the URL stay the same as what is typed originally, I thought removing the [R] flags would stop
I have these Rewrites, but I would like to have the URL stay the same as what is typed originally, I thought removing the [R] flags would stop it but it hasn't
RewriteCond %{HTTP_HOST} ^examplea.example.com$ [NC]
RewriteRule (.*) examplea.example.com:32400/web [L]
RewriteCond %{HTTP_HOST} ^exampleb.example.com$ [NC]
RewriteRule (.*) exampleb.example.com:9091 [L]
Edit: would this work better?
RewriteCond %{HTTP_HOST} ^hello.example.com$
RewriteRule ^(/)?$ welcome [L]
More posts by @Reiling115
1 Comments
Sorted by latest first Latest Oldest Best
It looks to me like you would are trying to fetch data from a web service that is running on another port and display it using your main web server.
mod_rewrite can be configured to do so. You have to have mod_proxy enabled and use [P] with your rewrite rules. Your directives might look like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^examplea.example.com$ [NC]
RewriteRule (.*) examplea.example.com:32400/web/ [P,L]
ProxyPassReverse / examplea.example.com/
RewriteCond %{HTTP_HOST} ^exampleb.example.com$ [NC]
RewriteRule (.*) exampleb.example.com:9091/ [P,L]
ProxyPassReverse / exampleb.example.com/
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.