<pre class="prettyprint lang-config">
SetEnvIfNoCase User-Agent ^NameOfBadRobot goaway
<Location /secret/files>
- Order allow,deny
- Allow from all
- Deny from env=goaway
+ Order allow,deny
+ Allow from all
+ Deny from env=goaway
</Location>
</pre>
<highlight language="config">
SetEnvIfNoCase User-Agent ^NameOfBadRobot goaway
<Location /secret/files>
- Order allow,deny
- Allow from all
- Deny from env=goaway
+ Order allow,deny
+ Allow from all
+ Deny from env=goaway
</Location>
</highlight>
<p>
<pre class="prettyprint lang-config">
<VirtualHost *:80>
- ServerName www.example.com
- Redirect / https://www.example.com/
+ ServerName www.example.com
+ Redirect / https://www.example.com/
</VirtualHost >
<VirtualHost *:443>
- ServerName www.example.com
- # ... SSL configuration goes here
+ ServerName www.example.com
+ # ... SSL configuration goes here
</VirtualHost >
</pre>
<pre class="prettyprint lang-config">
<If "$req{Host} != 'www.example.com'">
- RedirectMatch (.*) http://www.example.com$1
+ RedirectMatch (.*) http://www.example.com$1
</If>
</pre>
<highlight language="config">
<VirtualHost *:80>
- ServerName www.example.com
- Redirect / https://www.example.com/
+ ServerName www.example.com
+ Redirect / https://www.example.com/
</VirtualHost >
<VirtualHost *:443>
- ServerName www.example.com
- # ... SSL configuration goes here
+ ServerName www.example.com
+ # ... SSL configuration goes here
</VirtualHost >
</highlight>
<highlight language="config">
<If "$req{Host} != 'www.example.com'">
- RedirectMatch (.*) http://www.example.com$1
+ RedirectMatch (.*) http://www.example.com$1
</If>
</highlight>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision : 1311806 -->
+<!-- English Revision: 1311806:1330312 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<variants>
<variant>en</variant>
- <variant>fr</variant>
+ <variant outdated="yes">fr</variant>
</variants>
</metafile>
use the Redirect directive. mod_rewrite was used in that earlier
example in order to hide the redirect from the client:</p>
- <pre class="prettyprint lang-config">
- Redirect /foo.html /bar.html
- </pre>
+ <pre class="prettyprint lang-config">Redirect /foo.html /bar.html</pre>
</dd>
# rewriting document.html to document.php
# when and only when document.php exists
<Directory /var/www/htdocs>
-<span class="indent">
-RewriteEngine on
-RewriteBase /var/www/htdocs
+ RewriteEngine on
+ RewriteBase /var/www/htdocs
-RewriteCond $1.php -f
-RewriteCond $1.html !-f
-RewriteRule ^(.*).html$ $1.php
-</span>
+ RewriteCond $1.php -f
+ RewriteCond $1.html !-f
+ RewriteRule ^(.*).html$ $1.php
</Directory>
</pre>
use the Redirect directive. mod_rewrite was used in that earlier
example in order to hide the redirect from the client:</p>
- <highlight language="config">
- Redirect /foo.html /bar.html
- </highlight>
+ <highlight language="config">Redirect /foo.html /bar.html</highlight>
</dd>
</dl>
# rewriting document.html to document.php
# when and only when document.php exists
<Directory /var/www/htdocs>
-<indent>
-RewriteEngine on
-RewriteBase /var/www/htdocs
+ RewriteEngine on
+ RewriteBase /var/www/htdocs
-RewriteCond $1.php -f
-RewriteCond $1.html !-f
-RewriteRule ^(.*).html$ $1.php
-</indent>
+ RewriteCond $1.php -f
+ RewriteCond $1.html !-f
+ RewriteRule ^(.*).html$ $1.php
</Directory>
</highlight>
</dd>
recipe:</p>
<pre class="prettyprint lang-config"><strong>#Product to ID configuration</strong>
- RewriteMap product2id txt:/etc/apache2/productmap.txt
- RewriteRule ^/product/(.*) /prods.php?id=${product2id:$1|NOTFOUND} [PT]
+RewriteMap product2id txt:/etc/apache2/productmap.txt
+RewriteRule ^/product/(.*) /prods.php?id=${product2id:$1|NOTFOUND} [PT]
</pre>
the int function, and then use that in your <code>RewriteRule</code>:
</p>
- <pre class="prettyprint lang-config"><strong>Redirect a URI to an all-lowercase version of itself</strong>
- RewriteMap lc int:tolower
- RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]
+ <pre class="prettyprint lang-config"><strong>#Redirect a URI to an all-lowercase version of itself</strong>
+RewriteMap lc int:tolower
+RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]
</pre>
recipe:</p>
<highlight language="config"><strong>#Product to ID configuration</strong>
- RewriteMap product2id txt:/etc/apache2/productmap.txt
- RewriteRule ^/product/(.*) /prods.php?id=${product2id:$1|NOTFOUND} [PT]
+RewriteMap product2id txt:/etc/apache2/productmap.txt
+RewriteRule ^/product/(.*) /prods.php?id=${product2id:$1|NOTFOUND} [PT]
</highlight>
<p>We assume here that the <code>prods.php</code> script knows what
the int function, and then use that in your <code>RewriteRule</code>:
</p>
- <highlight language="config"><strong>Redirect a URI to an all-lowercase version of itself</strong>
- RewriteMap lc int:tolower
- RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]
+ <highlight language="config"><strong>#Redirect a URI to an all-lowercase version of itself</strong>
+RewriteMap lc int:tolower
+RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]
</highlight>
<note>