TracNav menu
-
Core Features
- Configuration File Syntax
- Configuration Options
- Change Root
- Performance
- PerformanceFastCGI
- SSL
- Traffic Shaping
- Using SMP
-
Modules
- mod_accesslog
- mod_access
- mod_alias
- mod_auth
- mod_cache
- mod_cgi
- mod_cml
- mod_compress
- mod_deflate
- mod_dirlisting
- mod_evasive
- mod_evhost
- mod_expire
- mod_extforward
- mod_fastcgi
- mod_flv_streaming
- mod_geoip
- mod_magnet
- mod_mem_cache
- mod_mysql_vhost
- mod_proxy
- mod_redirect
- mod_rewrite
- mod_rrdtool
- mod_scgi
- mod_secdownload
- mod_setenv
- mod_simple_vhost
- mod_ssi
- mod_status
- mod_trigger_b4_dl
- mod_userdir
- mod_useronline
- mod_usertrack
- mod_webdav
-
Modules (1.5 only)
- mod_proxy_core
- mod_sql_vhost_core
- mod_uploadprogress
- mod_deflate
-
Internals
- FastCGI state-engine
- Plugin interface
- HTTP state-engine
-
Additional
- User written Modules
URL Redirection
Module: mod_redirect
Description
The redirect module is used to specify redirects for a set of URLs.
Options
- url.redirect
redirects a set of URLs externally
e.g.
url.redirect = ( "^/show/([0-9]+)/([0-9]+)$" => "http://www.example.org/show.php?isdn=$1&page$2", "^/get/([0-9]+)/([0-9]+)$" => "http://www.example.org/get.php?isdn=$1&page$2" ) # make an external redirect # from any www.host (with www.) to the host (without www.) $HTTP["host"] =~ "^www\.(.*)$" { url.redirect = ( "^/(.*)" => "http://%1/$1" ) }- url.redirect-code (Added in 1.5.0)
defines the http code that is sent with the redirect URL
e.g.
url.redirect-code = 302
Some people love the www part in the url. A general solution to move all non www. hosts to its www equivalent:
$HTTP["host"] =~ "^([^.]+\.[^.]+)$" {
url.redirect = (
".*" => "http://www.%1"
)
}
Moving any subdomains except a few to www.example.org: (Note: The second match is required since a non-match doesn't set any groups)
$HTTP["host"] !~ "^(www|mail|mysql)\.(example\.org)$" {
$HTTP["host"] =~ "^(.+\.)?(example\.org)$" {
url.redirect = (
"^/(.*)" => "http://www.%2/$1"
)
}
}

