T
T
TilloTill2021-07-21 17:06:47
Apache HTTP Server
TilloTill, 2021-07-21 17:06:47

How to configure apache redirect rule to another site (RewriteCond/RewriteRule)?

The essence of the problem: you need to redirect a request for a specific address on my site to another web service.
For example, all requests go without redirection, and requests like POST mydomain.com/v1/api/{methods} are redirected to POST service.com/api/{methods}.

I tried in different ways, but I could not master:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/api/v1/.*
RewriteRule ^/api/v1/(.*)$ http://service.com/v1/$1 [P,L]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question