From: Rich Bowen Date: Mon, 19 Apr 2010 11:53:38 +0000 (+0000) Subject: starting back on some of the things I want to add to the rewrite docs. X-Git-Tag: 2.3.6~200 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=924fbe62905bd8888c90b5f7c2a0e6ec6de1cc34;p=thirdparty%2Fapache%2Fhttpd.git starting back on some of the things I want to add to the rewrite docs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@935537 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/rewrite/avoid.html.en b/docs/manual/rewrite/avoid.html.en index 27a4a273939..3ba2ed41741 100644 --- a/docs/manual/rewrite/avoid.html.en +++ b/docs/manual/rewrite/avoid.html.en @@ -38,16 +38,95 @@ particular server configuration, so it's important that you understand them, rather than merely cutting and pasting the examples into your configuration.

+
This document is a work in progress.
+ -

See also

+

See also

top
-

Coming Soon ...

+

Simple Redirection

+ + +

mod_alias provides the Redirect and RedirectMatch directives, which provide a +means to redirect one URL to another. This kind of simple redirection of +one URL, or a class of URLs, to somewhere else, should be accomplished +using these directives rather than RewriteRule. RedirectMatch +allows you to include a regular expression in your redirection criteria, +providing many of the benefits of using RewriteRule.

+ +

A common use for RewriteRule is to redirect an entire +class of URLs. For example, all URLs in the /one directory +must be redirected to http://one.example.com/, or perhaps +all http requests must be redirected to +https.

+ +

These situations are better handled by the Redirect +directive. Remember that Redirect preserves path +information. That is to say, a redirect for a URL /one will +also redirect all URLs under that, such as /one/two.html +and /one/three/four.html.

+ +

To redirect URLs under /one to +http://one.example.com, do the following:

+ +

+Redirect /one/ http://one.example.com/ +

+ +

To redirect http URLs to https, do the +following:

+ +

+<VirtualHost *:80> +ServerName www.example.com
+Redirect / https://www.example.com/
+</VirtualHost > +
+<VirtualHost *:443> +ServerName www.example.com
+
+# ... SSL configuration goes here
+</VirtualHost > +

+ +

The use of RewriteRule to perform this task may be +appropriate if there are other RewriteRule directives in +the same scope. This is because, when there are Redirect +and RewriteRule directives in the same scope, the +RewriteRule directives will run first, regardless of the +order of appearance in the configuration file.

+ +

In the case of the http-to-https redirection, the use of +RewriteRule would be appropriate if you don't have access +to the main server configuration file, and are obliged to perform this +task in a .htaccess file instead.

+ +
top
+
+

URL Aliasing

+

Using Alias

+
top
+
+

Virtual Hosting

+

Virtual Hosts

+
top
+
+

Simple Proxying

+

ProxyPass

+
top
+
+

Environment Variable Testing

+ +
Parts of this section are applicable only to Apache HTTP +Server 2.3 and later.
+

Using SetEnvIf and <If> (2.3 and later.)

-

-This document currently being written. -

Available Languages:  en 

diff --git a/docs/manual/rewrite/avoid.xml b/docs/manual/rewrite/avoid.xml index eb620a38b2e..db2bb253695 100644 --- a/docs/manual/rewrite/avoid.xml +++ b/docs/manual/rewrite/avoid.xml @@ -43,6 +43,8 @@ particular server configuration, so it's important that you understand them, rather than merely cutting and pasting the examples into your configuration.

+This document is a work in progress. + Module documentation mod_rewrite introduction @@ -53,12 +55,88 @@ configuration.

Advanced techniques and tricks -
+
+Simple Redirection + +

mod_alias provides the Redirect and RedirectMatch directives, which provide a +means to redirect one URL to another. This kind of simple redirection of +one URL, or a class of URLs, to somewhere else, should be accomplished +using these directives rather than RewriteRule. RedirectMatch +allows you to include a regular expression in your redirection criteria, +providing many of the benefits of using RewriteRule.

+ +

A common use for RewriteRule is to redirect an entire +class of URLs. For example, all URLs in the /one directory +must be redirected to http://one.example.com/, or perhaps +all http requests must be redirected to +https.

+ +

These situations are better handled by the Redirect +directive. Remember that Redirect preserves path +information. That is to say, a redirect for a URL /one will +also redirect all URLs under that, such as /one/two.html +and /one/three/four.html.

+ +

To redirect URLs under /one to +http://one.example.com, do the following:

+ + +Redirect /one/ http://one.example.com/ + + +

To redirect http URLs to https, do the +following:

+ + +<VirtualHost *:80> +ServerName www.example.com
+Redirect / https://www.example.com/
+</VirtualHost > +
+<VirtualHost *:443> +ServerName www.example.com
+
+# ... SSL configuration goes here
+</VirtualHost > +
+ +

The use of RewriteRule to perform this task may be +appropriate if there are other RewriteRule directives in +the same scope. This is because, when there are Redirect +and RewriteRule directives in the same scope, the +RewriteRule directives will run first, regardless of the +order of appearance in the configuration file.

+ +

In the case of the http-to-https redirection, the use of +RewriteRule would be appropriate if you don't have access +to the main server configuration file, and are obliged to perform this +task in a .htaccess file instead.

+ +
+ +
URL Aliasing +

Using Alias

+
+ +
Virtual Hosting +

Virtual Hosts

+
+ +
Simple Proxying +

ProxyPass

+
+ +
Environment Variable Testing + +Parts of this section are applicable only to Apache HTTP +Server 2.3 and later. + +

Using SetEnvIf and <If> (2.3 and later.)

-Coming Soon ... -

-This document currently being written. -

+