Redirecting clients to Alternate PagesSituation 1You wish to transparently redirect one page within your document root to another. The basis of this example is from an international site with Language Negotiation enabled, but where the desired behavior was to redirect unhandled languages to a default English-language page. Some of the code necessary to do this has been removed for clarity. Solutionmatch URL into $ with ^/$
if matched then
set SCRATCH:LOC = http://www.example.com/en/homepage.html
set Response = 303
set OUT:Location = %{SCRATCH:LOC}
set OUT:Content-Type = text/html
set Body = <!doctype html public "-W3C/DTD HTML 3.2EN">
<html><head><title>303 See Other</title></head>
<body><p>See <a href="%{SCRATCH:LOC}">here</a>.</p></body></html>
endif
(Note that the " DescriptionThis example will send a TechnicalFor ease of maintainance, the location to redirect to is first stored in the temporary Situation 2You wish to operate a site where all content is stored on a secure server. To do this you have created two Virtual Servers, one standard and one secure, and wish to redirect all requests made to the standard server to the secure server instead, whilst keeping the details of the request intact. Solutionmatch URL into $ with (.*) if matched then set Response = 307 set OUT:Location = https://intranet.example.com$1 set OUT:Content-Type = text/html set Body = Go <a href="https://intranet.example.com$1">here</a> instead. endif DescriptionThis example will route clients from a directory on the standard server to the same place on the secure server. TechnicalThis example uses the Note how the original request (including the initial " Situation 3You are a company providing hosting facilities, and would like to allow your Web Server to handle redirections to the domains you host, rather than relying on (and having to update) a large number of DNS entries. Solutionmatch IN:Host into $ with ^.+$
if matched then
set RESPONSE = 302
set OUT:Location = http://www.domainhost.com/park.php?domain=%{IN:Host}
set BODY = <a href="http://www.domainhost.com/park.php?domain=%{IN:Host}">Go here instead</a>
endif DescriptionIn this situation, we have a Virtual Server with a script that redirects requests for a particular domain to a dynamically specified document root. TechincalThis rule matches any
Content Manager
[Administrator] 07 March 2006
Comments:This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Comment from:
MIke [Visitor]
Hi
How do you do a permanent redirect from http://domain.com to http://www.domain.com? I need to do this so that search engines don't index my site twice. Thanks Mike
Comment from:
Teenager [Visitor]
· http://teenssex.name/
Mike use Aliases : Aliases are a way of specifying 'alternative web addresses' for a website. Specify a list of additional host names for this website, separated by spaces. www.domain.com
|
Recent Articles
Other Resources
|


