mod_replace insights

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 16
Joined: 20 Nov 2013, 13:10

mod_replace insights

20 May 2014, 09:13

Hi!

Since I used mod_replace a lot in the last days I got two insights I want to share with you guys:

1) I had an encoding problem (German Umlaute) in my PHP pages. The mode_replace docu mentions this problem (http://www.helicontech.com/ape/doc/mod_replace.htm), but the solution is missing an essential detail:
Instead of SetEnv content-type windows-1251 one has to use SetEnv content-type-charset windows-1251

2) Another problem I had was the backreferencing in my ReplacePattern Rules: The examples in the docu mention \1 as backrefernce, which works for one pattern
e.g. ReplacePattern revproxy "(http|https)://origin.server/" "\1://revproxy/"

But when you need more than one backreference you have to use $1, $2, and so on:
This would *NOT* work: ReplacePattern revproxy "(http|https)://(origin).server/" "\1://\2.server"
but this would work: ReplacePattern revproxy "(http|https)://(origin).server/" "$1://$2.server"

Hope this is useful for someone!

regards
swobi

P.S.: @Helicon: Maybe you could add this to the documentation page?

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 6 guests