From: Rich Bowen
Simple Redirection
URL Aliasing
Virtual Hosting
Simple Proxying
Environment Variable Testingmod_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.
Using Alias
+Virtual Hosts
+ProxyPass
+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. +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:
To redirect http URLs to https, do the
+following:
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.
Using Alias
+Virtual Hosts
+ProxyPass
+Using SetEnvIf and <If> (2.3 and later.)
--This document currently being written. -