aks_header

Current version: 0.4.1

Support forum: English
Download: aks_header

Compress your pages on the fly!

This plugin based on mg_setheader by Mike Gravel.

Features:

  • Strip white spaces on the fly.
  • GZIP and deflate compress on the fly.
  • Set any page headers. It’s useful for create your custom feeds.
  • 301 redirect non exist pages or directories to other place.
  • Calculate and set Etag header
    .

Change log
0.3.2

  • Now plugin aks_301 included in aks_header (2 in 1)
  • Add support multiple URLs for 301 redirect
  • Add no-cache header

0.3.3

  • Rewrite code for compatibility with gbp_permanent_links and some other plugins

0.3.4

  • Fixed bug with file_download
  • Check if already using “zlib output compression”
  • Check for buggy versions of Internet Explorer

0.3.5

  • Added mask for redirect in aks_301 tag
  • Added attributes ignore and black to aks_301 tag
  • Fixed bug in strip function.

0.3.6

  • Fixed bug in strip function.

0.4.1 (02.07.2016)

  • Txp 4.6 fix

Tags

<txp:aks_header />

attributesdefaultsampledescription
name ‘Content-Type’ ‘Content-Type’ header
value ’‘ ‘application/rss+xml’ header
gzip ‘0’ ‘1’ GZIP compressions
strip ‘0’ ‘1’ Strip white spaces
nostrip ‘pre,code,textarea,script,style’ ‘pre’ Not Strip tags
file ‘0’ ‘1’ Auto set header per file extension
nodebug ‘0’ ‘1’ Set production_status = ‘live’
nocache ‘0’ ‘1’ Set no-cache header
etag ‘0’ ‘1’ Set Etag header, if production_status = ‘live’

Examples:

Place on top your page template

<txp:aks_header strip="1" gzip="1" /><!DOCTYPE html  . . .

or place on top your xml page template

<txp:aks_header name="Content-Type" value="application/rss+xml" strip="1" gzip="1" /><?xml version="1.0" . . .

Tests

Page Original size Strip white spaces GZIP Strip+GZIP
http://makss.uaho.net/plugins/aks_rss 16726 bytes 15385 bytes 4234 bytes 4039 bytes
Save space from original size 0 % 8 % 75 % 76 %

Set header per file extension. “File” attribute

Support file extensions:

	'txt' => 'text/plain',
	'css' => 'text/css',
	'js' => 'application/x-javascript',
	'xml' => 'application/rss+xml'

.

aks_301 – Simple 301 redirect with conditions

Summary

This tag useful for redirect non exist pages or directories to other place.
Default: to domain root.

Tags

<txp:aks_301 /> — place this tag !!!ONLY!!! to start your page.

Sample my error_default page:

<txp:aks_301 start="/categories/|/article/" /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
[skip...]

Attributes

Attribute Default Description
start ’‘ one or more conditions. Delimiter: |
url ‘http://yourdomain.com/’ one or more urls. Delimiter: | Default: your domail root
ignore ’‘ one or more conditions. Delimiter: |. Does nothing.
black ‘cltreq.asp|owssvr.dll’ one or more conditions. Delimiter: |. Return 404 header and exit.
Attribute Default Description
start @’‘@ one or more conditions. Delimiter: |
url @‘http://yourdomain.com/’@ one or more urls. Delimiter: | Default: your domail root
ignore @’‘@ one or more conditions. Delimiter: |. Does nothing.
black 'cltreq.asp|owssvr.dll' one or more conditions. Delimiter: |. Return 404 header and exit.

.

Examples

error_default page:

<txp:aks_301 start="/categories/" url="http://mydomain.com/somepage.html" />
all non exist pages in /categories/* - 301 redirect to http://mydomain.com/somepage.html
<txp:aks_301 start="/categories/|/section1/" />
all non exist pages in /categories/* and /section1/* - 301 redirect to domain root
<txp:aks_301 start="/" />
ALL non exist pages  - 301 redirect to domain root

default page:

<txp:aks_301 start="/categories/" url="http://mydomain.com/somepage.html" />
all EXIST pages in /categories/* - 301 redirect to http://mydomain.com/somepage.html
<txp:aks_301 start="/" url="http://otherdomain.com/" />
ALL EXIST pages  - 301 redirect to http://otherdomain.com/

.

HowTo use aks_header:

.