InTooDeep
InTooDeep

Reputation: 588

Apache Rewrite Rule Loop

I'm trying to create a rewrite rule that sends all traffic from one URL to another. For example, if somebody goes to:

https://www.mysite.co.uk/bundles/mypage.css?v=1234

I'd like the server to transparently send the request to:

https://www.mysite.co.uk/proxy/kibana.php/bundles/mypage.css?v=1234

I've added the following rewrite rule to apache config but I seem to be getting into a loop:

RewriteCond %{REQUEST_URI} !^/kibana.php/
RewriteRule /bundles/(.*)$ /proxy/kibana.php/bundles/$1 [P,L]

But the browser seems to be getting into a rewrite loop. Any ideas as to what I'm doing wrong?

Upvotes: 0

Views: 92

Answers (2)

InTooDeep
InTooDeep

Reputation: 588

Looks like I posted a little too quickly. I swapped out [P,L] with [NC,L,QSA] and all works as expected.

Upvotes: 1

Chamindu
Chamindu

Reputation: 716

I think the condition should be

RewriteCond %{REQUEST_URI} !^/proxy/kibana.php/

Upvotes: 0

Related Questions