Mobile app version of vmapp.org
Login or Join
Reiling115

: 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

@Reiling115

Posted in: #Htaccess #ModRewrite

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]

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Reiling115

1 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

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/

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme