From: Rich Bowen
However, there are situations where you'll need to use mod_rewrite - -primarily when you don't have access to the main server configuration -file, or if you wish to do this dynamically for a larger number of -hostnames. For these situations, you might use one of the recipes -below.
+You can alternatively accomplis this using the
+<If>
+directive:
+<If "%{HTTP_HOST} != 'www.example.com'">
+
+Redirect / http://www.example.com/
+
+</If>
+
Or, for example, to redirect a portion of your site to HTTPS, you +might do the following:
+ +
+<If "%{SERVER_PROTOCOL} != 'HTTPS'">
+
+Redirect /admin/ https://www.example.com/admin/
+
+</If>
+
If, for whatever reason, you still want to use mod_rewrite
+- if, for example, you need this to work with a larger set of RewriteRules -
+you might use one of the recipes below.
For sites running on a port other than 80:
diff --git a/docs/manual/rewrite/remapping.xml b/docs/manual/rewrite/remapping.xml index adebef2748..39ee76eea7 100644 --- a/docs/manual/rewrite/remapping.xml +++ b/docs/manual/rewrite/remapping.xml @@ -286,11 +286,32 @@ hostname(s). </VirtualHost>-
However, there are situations where you'll need to use mod_rewrite - -primarily when you don't have access to the main server configuration -file, or if you wish to do this dynamically for a larger number of -hostnames. For these situations, you might use one of the recipes -below.
+You can alternatively accomplis this using the
+
Or, for example, to redirect a portion of your site to HTTPS, you +might do the following:
+ +If, for whatever reason, you still want to use mod_rewrite
+- if, for example, you need this to work with a larger set of RewriteRules -
+you might use one of the recipes below.
For sites running on a port other than 80: