⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 urlmapping.html.en

📁 最新apache的源代码
💻 EN
📖 第 1 页 / 共 2 页
字号:
<?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><!--        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX              This file is generated from xml source: DO NOT EDIT        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX      --><title>Mapping URLs to Filesystem Locations - Apache HTTP Server</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 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="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="./images/feather.gif" /></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-project/">Documentation</a> &gt; <a href="./">Version 2.0</a></div><div id="page-content"><div id="preamble"><h1>Mapping URLs to Filesystem Locations</h1><div class="toplang"><p><span>Available Languages: </span><a href="./en/urlmapping.html" title="English">&nbsp;en&nbsp;</a> |<a href="./ja/urlmapping.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |<a href="./ko/urlmapping.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p></div>    <p>This document explains how Apache uses the URL of a request    to determine the filesystem location from which to serve a    file.</p>  </div><div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#related">Related Modules and Directives</a></li><li><img alt="" src="./images/down.gif" /> <a href="#documentroot">DocumentRoot</a></li><li><img alt="" src="./images/down.gif" /> <a href="#outside">Files Outside the DocumentRoot</a></li><li><img alt="" src="./images/down.gif" /> <a href="#user">User Directories</a></li><li><img alt="" src="./images/down.gif" /> <a href="#redirect">URL Redirection</a></li><li><img alt="" src="./images/down.gif" /> <a href="#proxy">Reverse Proxy</a></li><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></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><table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_alias.html">mod_alias</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_userdir.html">mod_userdir</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_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_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#rewritematch">RewriteMatch</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>    <p>In deciding what file to serve for a given request, Apache's    default behavior is to take the URL-Path for the request (the part    of the URL following the hostname and port) and add it to the end    of the <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code> specified    in your configuration files. Therefore, the files and directories    underneath the <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code>    make up the basic document tree which will be visible from the    web.</p>    <p>Apache 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    virtual host, or alternatively, the directives provided by the    module <code class="module"><a href="./mod/mod_vhost_alias.html">mod_vhost_alias</a></code> can    be used to dynamically determine the appropriate place from which    to serve content based on the requested IP address or    hostname.</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>    <p>There are frequently circumstances where it is necessary to    allow web access to parts of the filesystem that are not strictly    underneath the <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code>. Apache offers several    different ways to accomplish this. On Unix systems, symbolic links    can bring other parts of the filesystem under the <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code>. For security reasons,    Apache will follow symbolic links only if the <code class="directive"><a href="./mod/core.html#options">Options</a></code> setting for the relevant    directory includes <code>FollowSymLinks</code> or    <code>SymLinksIfOwnerMatch</code>.</p>    <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><div class="example"><p><code>Alias /docs /var/web</code></p></div>    <p>the URL <code>http://www.example.com/docs/dir/file.html</code>    will be served from <code>/var/web/dir/file.html</code>. The    <code class="directive"><a href="./mod/mod_alias.html#scriptalias">ScriptAlias</a></code> directive    works the same way, with the additional effect that all content    located at the target path is treated as CGI scripts.</p>    <p>For situations where you require additional flexibility, you    can use the <code class="directive"><a href="./mod/mod_alias.html#aliasmatch">AliasMatch</a></code> and     <code class="directive"><a href="./mod/mod_alias.html#scriptaliasmatch">ScriptAliasMatch</a></code>    directives to do powerful regular-expression based matching and    substitution. For example,</p><div class="example"><p><code>ScriptAliasMatch ^/~([a-zA-Z0-9]+)/cgi-bin/(.+)      /home/$1/cgi-bin/$2</code></p></div>    <p>will map a request to    <code>http://example.com/~user/cgi-bin/script.cgi</code> to the    path <code>/home/user/cgi-bin/script.cgi</code> and will treat    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>    <p>Traditionally on Unix systems, the home directory of a    particular <em>user</em> can be referred to as    <code>~user/</code>. The module <code class="module"><a href="./mod/mod_userdir.html">mod_userdir</a></code>    extends this idea to the web by allowing files under each user's    home directory to be accessed using URLs such as the    following.</p><div class="example"><p><code>http://www.example.com/~user/file.html</code></p></div>    <p>For security reasons, it is inappropriate to give direct    access to a user's home directory from the web. Therefore, the    <code class="directive"><a href="./mod/mod_userdir.html#userdir">UserDir</a></code> directive    specifies a directory underneath the user's home directory    where web files are located. Using the default setting of    <code>Userdir public_html</code>, the above URL maps to a file    at a directory like    <code>/home/user/public_html/file.html</code> where    <code>/home/user/</code> is the user's home directory as    specified in <code>/etc/passwd</code>.</p>    <p>There are also several other forms of the    <code>Userdir</code> directive which you can use on systems    where <code>/etc/passwd</code> does not contain the location of    the home directory.</p>    <p>Some people find the "~" symbol (which is often encoded on the    web as <code>%7e</code>) to be awkward and prefer to use an    alternate string to represent user directories. This functionality    is not supported by mod_userdir. However, if users' home    directories are structured in a regular way, then it is possible    to use the <code class="directive"><a href="./mod/mod_alias.html#aliasmatch">AliasMatch</a></code>    directive to achieve the desired effect. For example, to make    <code>http://www.example.com/upages/user/file.html</code> map to    <code>/home/user/public_html/file.html</code>, use the following

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -