Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

redirect - Apache 2.4 RewriteRule [R] works but not with [P]

Surly it's only a slight misunderstanding, but I'm stuck with a small problem for days. So I beg for your help

I'm trying to hide small REST-Service behind an Apache2.4 Server

  • The redirection works fine: RewriteRule "^/apis/resolver/(.*)" "http://otherhost:10000/$1" [R]

  • But with the Flag 'P' the Apache responds with 404. RewriteRule "^/apis/resolver/(.*)" "http://otherhost:10000/$1" [P] Yes, the 'apache' can reach 'otherhost'. :)

Additional Info:

In the error_log I found a hint [rewrite:trace2] ... [perdir /] rewrite 'proxy:http://otherhost:10000/foo/bar' -> '/index.php'

This is related to a part of the confiuration for WP:

<Location "/">
   RewriteRule ^index.php$ - [L]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule . /index.php [L]
</Location>

So I have to redefine my question: "Why is the flag [R] implicit [Last] but [P] not?"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...