]> granicus.if.org Git - apache/blobdiff - docs/manual/urlmapping.html.en
Help doc writer to spot places where:
[apache] / docs / manual / urlmapping.html.en
index 71da89d3696e8363797536040eefc3a2a1fbd09c..d0c1acafe137761bccac38a2031aa448b247d855 100644 (file)
@@ -1,22 +1,24 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
+<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
+<!--
         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
               This file is generated from xml source: DO NOT EDIT
         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
       -->
-<title>Mapping URLs to Filesystem Locations - Apache HTTP Server</title>
+<title>Mapping URLs to Filesystem Locations - Apache HTTP Server Version 2.5</title>
 <link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
 <link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
 <link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" />
-<script src="./style/scripts/prettify.js" type="text/javascript">
+<script src="./style/scripts/prettify.min.js" type="text/javascript">
 </script>
 
 <link href="./images/favicon.ico" rel="shortcut icon" /></head>
 <body id="manual-page"><div id="page-header">
-<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p>
+<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p>
 <p class="apache">Apache HTTP Server Version 2.5</p>
-<img alt="" src="./images/feather.gif" /></div>
+<img alt="" src="./images/feather.png" /></div>
 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="./images/left.gif" /></a></div>
 <div id="path">
 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="./">Version 2.5</a></div><div id="page-content"><div id="preamble"><h1>Mapping URLs to Filesystem Locations</h1>
 <li><img alt="" src="./images/down.gif" /> <a href="#rewrite">Rewriting Engine</a></li>
 <li><img alt="" src="./images/down.gif" /> <a href="#notfound">File Not Found</a></li>
 <li><img alt="" src="./images/down.gif" /> <a href="#other">Other URL Mapping Modules</a></li>
-</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
+</ul><h3>See also</h3><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
 <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="related" id="related">Related Modules and Directives</a></h2>
+<h2><a name="related" id="related">Related Modules and Directives</a> <a title="Permanent link" href="#related" class="permalink">&para;</a></h2>
 
-<table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_actions.html">mod_actions</a></code></li><li><code class="module"><a href="./mod/mod_alias.html">mod_alias</a></code></li><li><code class="module"><a href="./mod/mod_dir.html">mod_dir</a></code></li><li><code class="module"><a href="./mod/mod_imagemap.html">mod_imagemap</a></code></li><li><code class="module"><a href="./mod/mod_negotiation.html">mod_negotiation</a></code></li><li><code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code></li><li><code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code></li><li><code class="module"><a href="./mod/mod_speling.html">mod_speling</a></code></li><li><code class="module"><a href="./mod/mod_userdir.html">mod_userdir</a></code></li><li><code class="module"><a href="./mod/mod_vhost_alias.html">mod_vhost_alias</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_alias.html#alias">Alias</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#aliasmatch">AliasMatch</a></code></li><li><code class="directive"><a href="./mod/mod_speling.html#checkspelling">CheckSpelling</a></code></li><li><code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code></li><li><code class="directive"><a href="./mod/core.html#errordocument">ErrorDocument</a></code></li><li><code class="directive"><a href="./mod/core.html#options">Options</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxypass">ProxyPass</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxypassreverse">ProxyPassReverse</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxypassreversecookiedomain">ProxyPassReverseCookieDomain</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxypassreversecookiepath">ProxyPassReverseCookiePath</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#redirect">Redirect</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#redirectmatch">RedirectMatch</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewritecond">RewriteCond</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewriterule">RewriteRule</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#scriptalias">ScriptAlias</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#scriptaliasmatch">ScriptAliasMatch</a></code></li><li><code class="directive"><a href="./mod/mod_userdir.html#userdir">UserDir</a></code></li></ul></td></tr></table>
+<table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_actions.html">mod_actions</a></code></li><li><code class="module"><a href="./mod/mod_alias.html">mod_alias</a></code></li><li><code class="module"><a href="./mod/mod_autoindex.html">mod_autoindex</a></code></li><li><code class="module"><a href="./mod/mod_dir.html">mod_dir</a></code></li><li><code class="module"><a href="./mod/mod_imagemap.html">mod_imagemap</a></code></li><li><code class="module"><a href="./mod/mod_negotiation.html">mod_negotiation</a></code></li><li><code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code></li><li><code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code></li><li><code class="module"><a href="./mod/mod_speling.html">mod_speling</a></code></li><li><code class="module"><a href="./mod/mod_userdir.html">mod_userdir</a></code></li><li><code class="module"><a href="./mod/mod_vhost_alias.html">mod_vhost_alias</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_alias.html#alias">Alias</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#aliasmatch">AliasMatch</a></code></li><li><code class="directive"><a href="./mod/mod_speling.html#checkspelling">CheckSpelling</a></code></li><li><code class="directive"><a href="./mod/mod_dir.html#directoryindex">DirectoryIndex</a></code></li><li><code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code></li><li><code class="directive"><a href="./mod/core.html#errordocument">ErrorDocument</a></code></li><li><code class="directive"><a href="./mod/core.html#options">Options</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxypass">ProxyPass</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxypassreverse">ProxyPassReverse</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxypassreversecookiedomain">ProxyPassReverseCookieDomain</a></code></li><li><code class="directive"><a href="./mod/mod_proxy.html#proxypassreversecookiepath">ProxyPassReverseCookiePath</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#redirect">Redirect</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#redirectmatch">RedirectMatch</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewritecond">RewriteCond</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewriterule">RewriteRule</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#scriptalias">ScriptAlias</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#scriptaliasmatch">ScriptAliasMatch</a></code></li><li><code class="directive"><a href="./mod/mod_userdir.html#userdir">UserDir</a></code></li></ul></td></tr></table>
 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="documentroot" id="documentroot">DocumentRoot</a></h2>
+<h2><a name="documentroot" id="documentroot">DocumentRoot</a> <a title="Permanent link" href="#documentroot" class="permalink">&para;</a></h2>
 
     <p>In deciding what file to serve for a given request, httpd's
     default behavior is to take the URL-Path for the request (the part
     in the file <code>/var/www/html/fish/guppies.html</code> being
     served to the requesting client.</p>
 
+    <p>If a directory is requested (i.e. a path ending with
+    <code>/</code>), the file served from that directory is defined by
+    the <code class="directive"><a href="./mod/mod_dir.html#directoryindex">DirectoryIndex</a></code> directive.
+    For example, if <code>DocumentRoot</code> were set as above, and
+    you were to set:</p>
+
+    <div class="example"><p><code>DirectoryIndex index.html index.php</code></p></div>
+
+    <p>Then a request for <code>http://www.example.com/fish/</code> will
+    cause httpd to attempt to serve the file
+    <code>/var/www/html/fish/index.html</code>. In the event that
+    that file does not exist, it will next attempt to serve the file
+    <code>/var/www/html/fish/index.php</code>.</p>
+
+    <p>If neither of these files existed, the next step is to
+    attempt to provide a directory index, if
+    <code class="module"><a href="./mod/mod_autoindex.html">mod_autoindex</a></code> is loaded and configured to permit
+    that.</p>
+
     <p>httpd is also capable of <a href="vhosts/">Virtual
     Hosting</a>, where the server receives requests for more than one
     host. In this case, a different <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code> can be specified for each
     (<code>httpd.conf</code>) and, possibly, once per additional <a href="vhosts/">Virtual Host</a> you create.</p>
 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="outside" id="outside">Files Outside the DocumentRoot</a></h2>
+<h2><a name="outside" id="outside">Files Outside the DocumentRoot</a> <a title="Permanent link" href="#outside" class="permalink">&para;</a></h2>
 
     <p>There are frequently circumstances where it is necessary to
     allow web access to parts of the filesystem that are not strictly
     <p>Alternatively, the <code class="directive"><a href="./mod/mod_alias.html#alias">Alias</a></code> directive will map any part
     of the filesystem into the web space. For example, with</p>
 
-<pre class="prettyprint lang-config">Alias /docs /var/web</pre>
+    <pre class="prettyprint lang-config">Alias "/docs" "/var/web"</pre>
 
 
     <p>the URL <code>http://www.example.com/docs/dir/file.html</code>
     expression</a> based matching and substitution. For
     example,</p>
 
-    <pre class="prettyprint lang-config">
-    ScriptAliasMatch ^/~([a-zA-Z0-9]+)/cgi-bin/(.+)   /home/$1/cgi-bin/$2
-    </pre>
+    <pre class="prettyprint lang-config">ScriptAliasMatch "^/~([a-zA-Z0-9]+)/cgi-bin/(.+)"   "/home/$1/cgi-bin/$2"</pre>
 
 
     <p>will map a request to
     the resulting file as a CGI script.</p>
 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="user" id="user">User Directories</a></h2>
+<h2><a name="user" id="user">User Directories</a> <a title="Permanent link" href="#user" class="permalink">&para;</a></h2>
 
     <p>Traditionally on Unix systems, the home directory of a
     particular <em>user</em> can be referred to as
     <code>/home/user/public_html/file.html</code>, use the following
     <code>AliasMatch</code> directive:</p>
 
-    <pre class="prettyprint lang-config">
-    AliasMatch ^/upages/([a-zA-Z0-9]+)(/(.*))?$   /home/$1/public_html/$3
-    </pre>
+    <pre class="prettyprint lang-config">AliasMatch "^/upages/([a-zA-Z0-9]+)(/(.*))?$"   "/home/$1/public_html/$3"</pre>
 
 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="redirect" id="redirect">URL Redirection</a></h2>
+<h2><a name="redirect" id="redirect">URL Redirection</a> <a title="Permanent link" href="#redirect" class="permalink">&para;</a></h2>
 
     <p>The configuration directives discussed in the above sections
     tell httpd to get content from a specific place in the filesystem
     to the new directory <code>/bar/</code>, you can instruct clients
     to request the content at the new location as follows:</p>
 
-    <pre class="prettyprint lang-config">
-    Redirect permanent /foo/   http://www.example.com/bar/
-    </pre>
+    <pre class="prettyprint lang-config">Redirect permanent "/foo/"   "http://www.example.com/bar/"</pre>
 
 
     <p>This will redirect any URL-Path starting in
     for the site home page to a different site, but leave all other
     requests alone, use the following configuration:</p>
 
-    <pre class="prettyprint lang-config">
-    RedirectMatch permanent ^/$    http://www.example.com/startpage.html
-    </pre>
+    <pre class="prettyprint lang-config">RedirectMatch permanent "^/$"    "http://www.example.com/startpage.html"</pre>
 
 
     <p>Alternatively, to temporarily redirect all pages on one site
     to a particular page on another site, use the following:</p>
 
-    <pre class="prettyprint lang-config">
-    RedirectMatch temp .*  http://othersite.example.com/startpage.html
-    </pre>
+    <pre class="prettyprint lang-config">RedirectMatch temp ".*"  "http://othersite.example.com/startpage.html"</pre>
 
 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="proxy" id="proxy">Reverse Proxy</a></h2>
+<h2><a name="proxy" id="proxy">Reverse Proxy</a> <a title="Permanent link" href="#proxy" class="permalink">&para;</a></h2>
 
 <p>httpd also allows you to bring remote documents into the URL space
 of the local server.  This technique is called <em>reverse
@@ -224,12 +235,10 @@ the <code>/bar/</code> directory on <code>internal.example.com</code>
 and returns them to the client as if they were from the local
 server.</p>
 
-<pre class="prettyprint lang-config">
-ProxyPass /foo/ http://internal.example.com/bar/<br />
-ProxyPassReverse /foo/ http://internal.example.com/bar/<br />
-ProxyPassReverseCookieDomain internal.example.com public.example.com<br />
-ProxyPassReverseCookiePath /foo/ /bar/
-</pre>
+<pre class="prettyprint lang-config">ProxyPass        "/foo/" "http://internal.example.com/bar/"
+ProxyPassReverse "/foo/" "http://internal.example.com/bar/"
+ProxyPassReverseCookieDomain internal.example.com public.example.com
+ProxyPassReverseCookiePath "/foo/" "/bar/"</pre>
 
 
 <p>The <code class="directive"><a href="./mod/mod_proxy.html#proxypass">ProxyPass</a></code> configures
@@ -249,18 +258,16 @@ breaking out of the proxy server and requesting directly from
 content) in a page as it is being served to the client using
 <code class="module"><a href="./mod/mod_substitute.html">mod_substitute</a></code>.</p>
 
-<pre class="prettyprint lang-config">
-Substitute s/internal\.example\.com/www.example.com/i
-</pre>
+<pre class="prettyprint lang-config">Substitute s/internal\.example\.com/www.example.com/i</pre>
 
 
-<p>For more sophisticated rewriting of links in HTML and XHTML, the 
+<p>For more sophisticated rewriting of links in HTML and XHTML, the
 <code class="module"><a href="./mod/mod_proxy_html.html">mod_proxy_html</a></code> module is also available. It allows you
 to create maps of URLs that need to be rewritten, so that complex
 proxying scenarios can be handled.</p>
 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="rewrite" id="rewrite">Rewriting Engine</a></h2>
+<h2><a name="rewrite" id="rewrite">Rewriting Engine</a> <a title="Permanent link" href="#rewrite" class="permalink">&para;</a></h2>
 
     <p>When even more powerful substitution is required, the rewriting
     engine provided by <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code>
@@ -275,7 +282,7 @@ proxying scenarios can be handled.</p>
     <a href="rewrite/">detailed mod_rewrite documentation</a>.</p>
 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="notfound" id="notfound">File Not Found</a></h2>
+<h2><a name="notfound" id="notfound">File Not Found</a> <a title="Permanent link" href="#notfound" class="permalink">&para;</a></h2>
 
     <p>Inevitably, URLs will be requested for which no matching
     file can be found in the filesystem. This can happen for
@@ -308,8 +315,8 @@ proxying scenarios can be handled.</p>
 
     <p><code class="module"><a href="./mod/mod_dir.html">mod_dir</a></code> provides <code class="directive"><a href="./mod/mod_dir.html#fallbackresource">FallbackResource</a></code>, which can be used to map virtual
     URIs to a real resource, which then serves them. This is a very
-    useful replace to <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code> when implementing
-    a 'front controler'</p>
+    useful replacement for <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code> when implementing
+    a 'front controller'</p>
 
     <p>If all attempts to locate the content fail, httpd returns
     an error page with HTTP status code 404 (file not found). The
@@ -320,7 +327,7 @@ proxying scenarios can be handled.</p>
     document.</p>
 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="other" id="other">Other URL Mapping Modules</a></h2>
+<h2><a name="other" id="other">Other URL Mapping Modules</a> <a title="Permanent link" href="#other" class="permalink">&para;</a></h2>
 
 
 
@@ -348,15 +355,14 @@ proxying scenarios can be handled.</p>
 </div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
 <script type="text/javascript"><!--//--><![CDATA[//><!--
 var comments_shortname = 'httpd';
-var comments_identifier = 'http://httpd.apache.org/docs/2.4/urlmapping.html.en';
+var comments_identifier = 'http://httpd.apache.org/docs/trunk/urlmapping.html';
 (function(w, d) {
-    var disabled = false;
-    if (w.location.hostname.toLowerCase() == "httpd.apache.org" && disabled !== true) {
+    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
         d.write('<div id="comments_thread"><\/div>');
         var s = d.createElement('script');
         s.type = 'text/javascript';
         s.async = true;
-        s.src = 'http://c.apaste.info/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
+        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
     }
     else {
@@ -364,8 +370,8 @@ var comments_identifier = 'http://httpd.apache.org/docs/2.4/urlmapping.html.en';
     }
 })(window, document);
 //--><!]]></script></div><div id="footer">
-<p class="apache">Copyright 2012 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
-<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
+<p class="apache">Copyright 2019 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
+<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
 if (typeof(prettyPrint) !== 'undefined') {
     prettyPrint();
 }