Posts Tagged 2.4

Apache 2.4.x Better than rewriting

With httpd Apache 2.4.x is is more simple to do stuff than with 2.2.x

Like forcing the www. in front of a domain. Apache now supports the If Elseif Else :-) Pretty nice!
Light example

<If "$req{Host} != 'www.example.com'">
    RedirectMatch (.*) http://www.example.com$1
</If>

Easy, isn’t it?

A bit more old fashion way, so you can use the %{bla} stuff you already know.

<If "%{HTTP_HOST} == 'example.com'">
Redirect permanent / http://www.example.com
</If>

Also nice is the Define Directive.

OK you have to start apache with the -D parameter. Like httpd -D TEST

<IfDefine TEST>
Define servername test.example.com
</IfDefine>
<IfDefine !TEST>
Define servername www.example.com
Define SSL
</IfDefine>

If you have some example, please let me know!

Tags: , , , , ,

first script for mod_lua apache2.3/2.4

function handle(r)
	r.content_type = "text/html"
	--r.headers_out["X-Powered-By"] = "mod_lua; " .. _VERSION
	r:puts("Hi!")
	return apache2.OK
end

Mod lua expects a function with the name handle() else there is a 500 Error. The error handling is pretty anoying…

Tags: , , , ,

Archives by Subject:

Archives by Month: