{"id":324,"date":"2010-07-07T16:30:33","date_gmt":"2010-07-07T08:30:33","guid":{"rendered":"http:\/\/elon.852128.com\/blog\/?p=324"},"modified":"2010-07-07T18:15:38","modified_gmt":"2010-07-07T10:15:38","slug":"apache-redirect-match-%e5%8c%b9%e9%85%8d%e9%87%8d%e5%ae%9a%e5%90%91","status":"publish","type":"post","link":"https:\/\/elon.852128.com\/blog\/2010\/07\/07\/apache-redirect-match-%e5%8c%b9%e9%85%8d%e9%87%8d%e5%ae%9a%e5%90%91\/","title":{"rendered":"Apache Redirect Match \u5339\u914d\u91cd\u5b9a\u5411"},"content":{"rendered":"<p>\u4ece\u4e00\u4e2a\u57df\u540d\u6539\u5230\u53e6\u4e00\u4e2a\u57df\u540d\uff0c\u6216\u8005\u5bf9\u670d\u52a1\u5668\u7684\u76ee\u5f55\u7ed3\u6784\u8fdb\u884c\u8c03\u6574\u65f6\uff0c\u4f60\u7684\u7528\u6237\u8fd8\u662f\u4ece\u8001\u7684\u76ee\u5f55\u8fdb\u6765\uff0c\u5c31\u53ef\u80fd\u4f1a\u9047\u5230\u627e\u4e0d\u5230\u6587\u4ef6\uff0c\u6216\u662f\u8bbf\u95ee\u7981\u6b62\u7b49\u7b49\u95ee\u9898\u3002<\/p>\n<p>\u8fd9\u65f6\u5019RedirectMatch\u5c31\u663e\u5f97\u975e\u5e38\u6709\u7528\uff0c\u5982\u679c\u4f60\u79df\u7528\u7684\u865a\u62df\u4e3b\u673a\u662fapache\uff0c\u90a3\u4e48\u606d\u559c\u4f60\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528\u76ee\u5f55\u4e0b\u7684.htaccess\u91cc\u8bbe\u7f6e RedirectMatch\u3002<\/p>\n<p>\u8bed\u6cd5: RedirectMatch [status] regex URL<\/p>\n<p>regex \u4e3a regular expressions \u7684\u7f29\u5199\uff0c\u5177\u4f53\u53c2\u8003 Apache \u624b\u518c\u3002<\/p>\n<p>\u5e94\u7528: \u670d\u52a1\u5668\u914d\u7f6e, \u865a\u62df\u4e3b\u673a, \u76ee\u5f55, .htaccess\u6587\u4ef6<\/p>\n<p>\u4e3e\u4f8b:<\/p>\n<p>1) \u5c06\u4e00\u4e2a\u76ee\u5f55\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\uff1a<\/p>\n<p>RedirectMatch 301 ^\/lastdir$ \/lastdir.html<\/p>\n<p>2) \u5c06A\u76ee\u5f55\u91cd\u5b9a\u5411\u5230B\u76ee\u5f55\uff1a<\/p>\n<p>RedirectMatch 301 ^\/dir_a$ \/dir_b<\/p>\n<p>3) \u5c06A\u76ee\u5f55\u4e0b\u6240\u6709\u7684\u6587\u4ef6\u91cd\u5b9a\u5411\u5230B\u76ee\u5f55\uff1a<\/p>\n<p>RedirectMatch 301 ^\/dir_a\/.* \/dir_b<\/p>\n<p>4) \u5c06A\u76ee\u5f55\u4e0b\u6240\u6709\u7684\u6587\u4ef6\u91cd\u5b9a\u5411\u5230B\u76ee\u5f55\u76f8\u5bf9\u5e94\u7684\u6587\u4ef6\uff1a<\/p>\n<p>RedirectMatch 301 ^\/dir_a\/(.*) \/dir_b\/$1<\/p>\n<p>$1\u8868\u793a\u4e0a\u9762\u5706\u62ec\u5f27\u4e2d\u7684\u53d8\u91cf\uff0c\u5982\u679c\u6709\u591a\u4e2a\u5706\u62ec\u5f27\uff0c\u5219\u6309\u987a\u5e8f\u4e3a $2,$3<\/p>\n<p>5) \u5c06A\u76ee\u5f55\u4e0b\u6240\u6709\u7684\u6587\u4ef6\u91cd\u5b9a\u5411\u5230B\u670d\u52a1\u5668\u7684C\u76ee\u5f55\u76f8\u5bf9\u5e94\u7684\u6587\u4ef6\uff1a<\/p>\n<p>RedirectMatch 301 ^\/dir_a\/(.*) http:\/\/www.b.com\/dir_c\/$1<\/p>\n<p>\u8fd9\u4e2a\u5bf9\u6709\u4e9b\u539f\u5148\u4f7f\u7528\u4e2a\u4eba\u7a7a\u95f4\uff0c\u800c\u73b0\u5728\u6709\u4e86\u81ea\u5df1\u7684\u670d\u52a1\u5668\u6216\u8005\u865a\u62df\u4e3b\u673a\u7684\u4eba\u6765\u8bf4\u975e\u5e38\u6709\u7528\uff0c<\/p>\n<p>\u6bd4\u5982\u539f\u5148\u662f www.wz.zj.cn\/~mypage<\/p>\n<p>\u800c\u73b0\u5728\u6709\u4e86www.myweb.com \u8fd9\u4e2a\u7a7a\u95f4<\/p>\n<p>\u90a3\u4e48\u5c31\u53ef\u4ee5\u5728\u539f\u4e2a\u4eba\u7a7a\u95f4\u7684\u76ee\u5f55\u4e0b\u7f16\u8f91 .htaccess \u52a0\u5165\uff1a<\/p>\n<p>RedirectMatch 301 ^\/~dir_a\/(.*) http:\/\/www.mypage.com\/$1<\/p>\n<p>\u5982\u679c\u57df\u540d\u53d1\u751f\u53d8\u66f4\uff0c\u53ef\u4ee5\u8fd9\u6837\uff1a<\/p>\n<p>RedirectMatch 301 ^(.*) http:\/\/www.newdomaim.com\/$1<\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<p>\u7b26\u53f7 ^ \u8868\u793a\u5339\u914d\u9879\u7684\u5f00\u59cb, \u7b26\u53f7 $ \u8868\u793a\u7ed3\u675f\uff0c\u7b26\u53f7 * \u4ee3\u8868\u901a\u914d\u7b26\uff0c\u7b26\u53f7 () \u5b9a\u4e49\u53d8\u91cf\uff0c$1, $2 \u4e3a\u53d8\u91cf\u540d\u3002<\/p>\n<p>301\uff0c\u662f\u72b6\u6001\u7801\uff0c\u8868\u793a\u6c38\u4e45\u91cd\u5b9a\u5411\uff0c\u53e6\u5916\u8fd8\u6709\uff1a<\/p>\n<p>302\uff0c\u4e34\u65f6\u91cd\u5b9a\u5411\uff0c\u5982\u679c\u4e0d\u5199\u72b6\u6001\u7801\uff0c\u5219\u8fd9\u4e2a\u5c31\u662f\u9ed8\u8ba4\u503c\u3002<\/p>\n<p>303\uff0c\u7cfb\u7edf\u4f1a\u6709\u4e00\u4e2a\u9875\u9762\uff0c\u6307\u51fa\u8d44\u6e90\u5730\u5740\u5df2\u7ecf\u6539\u53d8\u3002<\/p>\n<p>410\uff0c\u8868\u793a\u8d44\u6e90\u5730\u5740\u5df2\u7ecf\u6c38\u4e45\u5220\u9664<\/p>\n<div id=\"page-content\">\n<div id=\"preamble\">\n<h1>Apache\u6a21\u5757 mod_alias<\/h1>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/module-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u63d0\u4f9b\u4ece\u6587\u4ef6\u7cfb\u7edf\u7684\u4e0d\u540c\u90e8\u5206\u5230\u6587\u6863\u6811\u7684\u6620\u5c04\u548cURL\u91cd\u5b9a\u5411<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/module-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/module-dict.html#ModuleIdentifier\">\u6a21\u5757\u540d<\/a><\/th>\n<td>alias_module<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/module-dict.html#SourceFile\">\u6e90\u6587\u4ef6<\/a><\/th>\n<td>mod_alias.c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u6982\u8ff0<\/h3>\n<p>\u6b64\u6a21\u5757\u63d0\u4f9b\u7684\u6307\u4ee4\u53ef\u4ee5\u64cd\u63a7\u4f5c\u4e3a\u8bf7\u6c42\u5230\u8fbe\u670d\u52a1\u5668\u7684URL\u3002<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#alias\">Alias<\/a><\/code>\u548c<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#scriptalias\">ScriptAlias<\/a><\/code>\u6307\u4ee4\u7528\u4e8e\u5728URL\u548c\u6587\u4ef6\u7cfb\u7edf\u8def\u5f84\u4e4b\u95f4\u5b9e\u73b0\u6620\u5c04\uff0c\u4f7f\u4e0d\u5728<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/core.html#documentroot\">DocumentRoot<\/a><\/code>\u76ee\u5f55\u4e0b\u7684\u5185\u5bb9\u4e5f\u80fd\u6210\u4e3a\u6587\u6863\u6811\u7684\u4e00\u90e8\u5206\uff0c\u5176\u4e2d\uff0c<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#scriptalias\">ScriptAlias<\/a><\/code>\u6307\u4ee4\u6709\u66f4\u591a\u4e00\u5c42\u7684\u542b\u4e49\uff0c\u5b83\u6807\u660e\u6b64\u76ee\u6807\u76ee\u5f55\u4e0b\u53ea\u6709CGI\u811a\u672c\u3002<\/p>\n<p><code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#redirect\">Redirect<\/a><\/code>\u6307\u4ee4\u5f15\u5bfc\u5ba2\u6237\u7aef\u4ee5\u4e00\u4e2a\u4e0d\u540c\u7684URL\u4ea7\u751f\u4e00\u4e2a\u65b0\u7684\u8bf7\u6c42\uff0c\u5e38\u7528\u4e8e\u4e00\u4e2a\u8d44\u6e90\u88ab\u79fb\u52a8\u5230\u4e00\u4e2a\u65b0\u4f4d\u7f6e\u7684\u65f6\u5019\u3002<\/p>\n<p><code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html\">mod_alias<\/a><\/code>\u88ab\u8bbe\u8ba1\u6210\u5904\u7406\u666e\u901a\u7684URL\u64cd\u4f5c\u3002\u590d\u6742\u7684URL\u64cd\u4f5c\uff0c\u6bd4\u5982\u5904\u7406\u8bf7\u6c42\u5b57\u7b26\u4e32\uff0c\u8bf7\u4f7f\u7528<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_rewrite.html\">mod_rewrite<\/a><\/code>\u63d0\u4f9b\u7684\u5f3a\u5927\u529f\u80fd\u3002<\/p>\n<\/div>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<div>\n<h2><a id=\"order\" name=\"order\">\u5904\u7406\u987a\u5e8f<\/a><\/h2>\n<p>\u51fa\u73b0\u5728\u4e0d\u540c\u4f5c\u7528\u57df(context)\u4e2d\u7684\u522b\u540d\u6307\u4ee4\u4ee5\u53ca\u91cd\u5b9a\u5411\u6307\u4ee4\u548c\u5176\u4ed6\u6307\u4ee4\u4e00\u6837\uff0c\u6309\u7167\u6807\u51c6\u7684<a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/sections.html#mergin\">\u5408\u5e76\u89c4\u5219<\/a>\u8fdb\u884c\u5904\u7406\u3002\u4f46\u662f\u5f53\u591a\u4e2a\u522b\u540d\u6307\u4ee4\u6216\u91cd\u5b9a\u5411\u6307\u4ee4\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u4f5c\u7528\u57df(context)\u4e2d\u7684\u65f6\u5019(\u6bd4\u5982\u5728\u540c\u4e00\u4e2a<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/core.html#virtualhost\">&lt;VirtualHost&gt;<\/a><\/code>\u6bb5)\uff0c\u5904\u7406\u987a\u5e8f\u5c31\u6bd4\u8f83\u7279\u522b\u4e86\uff1a<\/p>\n<p>\u9996\u5148\uff0c\u6240\u6709\u91cd\u5b9a\u5411\u6307\u4ee4\u90fd\u4f18\u5148\u4e8e\u522b\u540d\u6307\u4ee4\u88ab\u5904\u7406\uff0c\u56e0\u6b64\u4e00\u4e2a\u5339\u914d<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#redirect\">Redirect<\/a><\/code>\u6216<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#redirectmatch\">RedirectMatch<\/a><\/code>\u7684\u8bf7\u6c42\u5c06\u6c38\u8fdc\u4e0d\u4f1a\u88ab\u522b\u540d\u6307\u4ee4\u5904\u7406\u3002\u5176\u6b21\uff0c\u522b\u540d\u6307\u4ee4\u548c\u91cd\u5b9a\u5411\u6307\u4ee4\u5c06\u6309\u7167\u4ed6\u4eec\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u5148\u540e\u987a\u5e8f\u8fdb\u884c\u5339\u914d\uff0c\u5e76\u7531\u6700\u5148\u5339\u914d\u5230\u7684\u6307\u4ee4\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<p>\u56e0\u4e3a\u8fd9\u4e2a\u539f\u56e0\uff0c\u5f53\u4e24\u4e2a\u6216\u4e24\u4e2a\u4ee5\u4e0a\u7684\u8fd9\u4e9b\u6307\u4ee4\u4f5c\u7528\u4e8e\u540c\u4e00\u4e2a\u5b50\u8def\u5f84\u65f6\uff0c\u4f60\u5fc5\u987b\u5c06\u6700\u7279\u6b8a\u7684\u8def\u5f84\u653e\u5728\u6700\u524d\u9762\uff0c\u4ee5\u4fbf\u6240\u6709\u6307\u4ee4\u90fd\u80fd\u6b63\u786e\u5730\u751f\u6548\u3002\u4f8b\u5982\u4e0b\u9762\u7684\u4f8b\u5b50\u5c06\u6309\u7167\u4f60\u539f\u672c\u7684\u610f\u613f\u6b63\u5e38\u5de5\u4f5c\uff1a<\/p>\n<div>\n<p><code>Alias \/foo\/bar \/baz<br \/>\nAlias \/foo \/gaq <\/code><\/p>\n<\/div>\n<p>\u4f46\u662f\uff0c\u5982\u679c\u5c06\u4e0a\u9762\u4e24\u6761\u6307\u4ee4\u7684\u987a\u5e8f\u98a0\u5012\uff0c\u5219\u540e\u4e00\u6761\u6307\u4ee4\u6c38\u8fdc\u4e5f\u5f97\u4e0d\u5230\u5339\u914d\u7684\u673a\u4f1a\u3002<\/p>\n<\/div>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<h2><a id=\"Alias\" name=\"Alias\">Alias<\/a> <a id=\"alias\" name=\"alias\">\u6307\u4ee4<\/a><\/h2>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u6620\u5c04URL\u5230\u6587\u4ef6\u7cfb\u7edf\u7684\u7279\u5b9a\u533a\u57df<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Syntax\">\u8bed\u6cd5<\/a><\/th>\n<td><code>Alias <var>URL-path<\/var> <var>file-path<\/var>|<var>directory-path<\/var><\/code><\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Context\">\u4f5c\u7528\u57df<\/a><\/th>\n<td>server config, virtual host<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Module\">\u6a21\u5757<\/a><\/th>\n<td>mod_alias<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><code>Alias<\/code>\u6307\u4ee4\u4f7f\u6587\u6863\u53ef\u4ee5\u88ab\u5b58\u50a8\u5728<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/core.html#documentroot\">DocumentRoot<\/a><\/code>\u4ee5\u5916\u7684\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u3002\u4ee5(%\u5df2\u89e3\u7801\u7684)<var>url-path<\/var>\u8def\u5f84\u5f00\u5934\u7684URL\u53ef\u4ee5\u88ab\u6620\u5c04\u5230\u4ee5<var>directory-path<\/var>\u5f00\u5934\u7684\u672c\u5730\u6587\u4ef6\u3002<\/p>\n<div>\n<h3>\u793a\u4f8b\uff1a<\/h3>\n<p><code>Alias \/image \/ftp\/pub\/image <\/code><\/p>\n<\/div>\n<p>\u5bf9&#8221;http:\/\/myserver\/image\/foo.gif&#8221;\u7684\u8bf7\u6c42\uff0c\u670d\u52a1\u5668\u5c06\u8fd4\u56de&#8221;\/ftp\/pub\/image\/foo.gif&#8221;\u6587\u4ef6\u3002\u56e0\u4e3a\u4ec5\u5339\u914d\u5b8c\u6574\u8def\u5f84\uff0c\u6240\u4ee5\u4e0a\u8ff0\u4f8b\u5b50\u4e0d\u4f1a\u5339\u914d\u5bf9&#8221;http:\/\/myserver\/imagefoo.gif&#8221;\u7684\u8bf7\u6c42\u3002\u5bf9\u4e8e\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\uff0c\u8bf7\u53c2\u89c1<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#aliasmatch\">AliasMatch<\/a><\/code>\u6307\u4ee4\u3002<\/p>\n<p>\u6ce8\u610f\uff1a\u5982\u679c<var>url-path<\/var>\u4e2d\u6709\u540e\u7f00&#8221;\/&#8221;\uff0c\u5219\u670d\u52a1\u5668\u8981\u6c42\u6709\u540e\u7f00&#8221;\/&#8221;\u4ee5\u6269\u5c55\u6b64\u522b\u540d\u3002\u4e5f\u5c31\u662f\u8bf4&#8221;<code>Alias \/icons\/ \/usr\/local\/apache\/icons\/<\/code>&#8220;\u5e76\u4e0d\u80fd\u5bf9&#8221;<code>\/icons<\/code>&#8220;\u5b9e\u73b0\u522b\u540d\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u53ef\u80fd\u9700\u8981\u989d\u5916\u6307\u5b9a\u4e00\u4e2a<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/core.html#directory\">&lt;Directory&gt;<\/a><\/code>\u6bb5\u6765\u8986\u76d6\u522b\u540d\u7684<em>\u6700\u7ec8\u5bf9\u8c61<\/em>\u3002\u7531\u4e8e\u53ea\u6709\u51fa\u73b0\u5728<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/core.html#directory\">&lt;Directory&gt;<\/a><\/code>\u6bb5\u4e4b\u524d\u7684\u522b\u540d\u624d\u4f1a\u88ab\u68c0\u6d4b\uff0c\u6240\u4ee5\u5b83\u53ea\u5bf9\u6700\u7ec8\u5bf9\u8c61\u751f\u6548\u3002(\u7531\u4e8e\u6267\u884c\u522b\u540d\u64cd\u4f5c\u4e4b\u524d<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/core.html#location\">&lt;Location&gt;<\/a><\/code>\u6bb5\u4f1a\u88ab\u9996\u5148\u626b\u63cf\u4e00\u6b21\uff0c\u6240\u4ee5\u5b83\u4eec\u4e5f\u662f\u6709\u6548\u7684)<\/p>\n<p>\u7279\u522b\u5730\uff0c\u5982\u679c\u5bf9\u5728<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/core.html#documentroot\">DocumentRoot<\/a><\/code>\u4e4b\u5916\u7684\u67d0\u4e2a\u76ee\u5f55\u5efa\u7acb\u4e86\u4e00\u4e2a<code>Alias<\/code> \uff0c\u5219\u53ef\u80fd\u9700\u8981\u660e\u786e\u7684\u5bf9\u76ee\u6807\u76ee\u5f55\u8bbe\u5b9a\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n<div>\n<h3>\u793a\u4f8b\uff1a<\/h3>\n<p><code>Alias \/image \/ftp\/pub\/image<br \/>\n&lt;Directory \/ftp\/pub\/image&gt;<br \/>\nOrder allow,deny<br \/>\nAllow from all<br \/>\n&lt;\/Directory&gt; <\/code><\/p>\n<\/div>\n<\/div>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<h2><a id=\"AliasMatch\" name=\"AliasMatch\">AliasMatch<\/a> <a id=\"aliasmatch\" name=\"aliasmatch\">\u6307\u4ee4<\/a><\/h2>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6620\u5c04URL\u5230\u6587\u4ef6\u7cfb\u7edf<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Syntax\">\u8bed\u6cd5<\/a><\/th>\n<td><code>AliasMatch <var>regex<\/var> <var>file-path<\/var>|<var>directory-path<\/var><\/code><\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Context\">\u4f5c\u7528\u57df<\/a><\/th>\n<td>server config, virtual host<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Module\">\u6a21\u5757<\/a><\/th>\n<td>mod_alias<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u4e2a\u6307\u4ee4\u4e0e<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#alias\">Alias<\/a><\/code>\u7b49\u6548\uff0c\u4f46\u662f\u5b83\u4f7f\u7528\u4e86\u6807\u51c6\u7684<a title=\"see glossary\" href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/glossary.html#regex\">\u6b63\u5219\u8868\u8fbe\u5f0f<\/a>\uff0c\u800c\u4e0d\u662f\u7b80\u5355\u7684\u524d\u7f00\u5339\u914d\u3002\u5982\u679c\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\u4e0eURL-path\u76f8\u5339\u914d\uff0c\u5219\u670d\u52a1\u5668\u4f1a\u628a\u6240\u5339\u914d\u7684\u62ec\u5f27\u4e2d\u7684\u5b57\u7b26\u4e32\u66ff\u6362\u5230\u8be5\u6307\u4ee4\u6240\u6307\u5b9a\u7684\u76ee\u6807\u5b57\u7b26\u4e32\u4e2d\uff0c\u5e76\u89c6\u4e4b\u4e3a\u4e00\u4e2a\u6587\u4ef6\u540d\u3002\u4f8b\u5982\uff0c\u8981\u4f7f\u7528&#8221;<code>\/icons<\/code>&#8220;\u76ee\u5f55\uff0c\u53ef\u4ee5\uff1a<\/p>\n<div>\n<p><code>AliasMatch ^\/icons(.*) \/usr\/local\/apache\/icons$1 <\/code><\/p>\n<\/div>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<h2><a id=\"Redirect\" name=\"Redirect\">Redirect<\/a> <a id=\"redirect\" name=\"redirect\">\u6307\u4ee4<\/a><\/h2>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u53d1\u9001\u4e00\u4e2a\u5916\u90e8\u91cd\u5b9a\u5411\u4f7f\u5ba2\u6237\u7aef\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u4e0d\u540c\u7684URL<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Syntax\">\u8bed\u6cd5<\/a><\/th>\n<td><code>Redirect [<var>status<\/var>] <var>URL-path<\/var> <var>URL<\/var><\/code><\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Context\">\u4f5c\u7528\u57df<\/a><\/th>\n<td>server config, virtual host, directory, .htaccess<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Override\">\u8986\u76d6\u9879<\/a><\/th>\n<td>FileInfo<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Module\">\u6a21\u5757<\/a><\/th>\n<td>mod_alias<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8be5\u6307\u4ee4\u5c06\u4e00\u4e2a\u8001URL\u6620\u5c04\u4e3a\u4e00\u4e2a\u65b0URL\uff0c\u6b64\u65b0URL\u88ab\u8fd4\u56de\u5230\u5ba2\u6237\u7aef\u4f7f\u4e4b\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u65b0\u5730\u5740\u3002<\/p>\n<p>\u8001<em>URL-path<\/em>\u662f\u4e00\u4e2a(%\u5df2\u89e3\u7801\u7684)\u4ee5&#8221;\/&#8221;\u5f00\u5934\u7684(\u7f51\u7edc\u7a7a\u95f4)\u7edd\u5bf9\u8def\u5f84\u3002\u65b0<em>URL<\/em>\u662f\u4e00\u4e2a(%\u5df2\u7f16\u7801\u7684)\u4ee5&#8221;\/&#8221;\u5f00\u5934\u7684(\u7f51\u7edc\u7a7a\u95f4)\u7edd\u5bf9\u8def\u5f84\u6216\u8005\u5305\u542b\u534f\u8bae\u540d\u548c\u4e3b\u673a\u540d\u7684\u5b8c\u6574URL\u3002\u5f53\u65b0<em>URL<\/em>\u4e0d\u5305\u542b\u534f\u8bae\u540d\u548c\u4e3b\u673a\u540d\u65f6\u5c06\u4f7f\u7528\u4e0e\u8001<em>URL-path<\/em>\u76f8\u540c\u7684\u5f53\u524d\u503c\u3002<\/p>\n<p>\u8fd9\u6837\uff0c\u5bf9\u4efb\u4f55\u4ee5\u8001<em>URL-path<\/em>\u5f00\u5934\u7684\u8bf7\u6c42\uff0c\u5c06\u8fd4\u56de\u4e00\u4e2a\u6307\u5411\u4ee5\u65b0<em>URL<\/em>\u5f00\u5934\u7684\u91cd\u5b9a\u5411\u5e94\u7b54\u3002<\/p>\n<div>\n<h3>\u793a\u4f8b\uff1a<\/h3>\n<p><code>Redirect \/service http:\/\/foo2.example.com\/service <\/code><\/p>\n<\/div>\n<p>\u5982\u679c\u5ba2\u6237\u7aef\u8bf7\u6c42&#8221;http:\/\/example.com\/service\/foo.txt&#8221;\uff0c\u5219\u4f1a\u88ab\u91cd\u5b9a\u5411\u5230&#8221;http:\/\/foo2.example.com\/service\/foo.txt&#8221;\u3002\u56e0\u4e3a\u4ec5\u5339\u914d\u5b8c\u6574\u8def\u5f84\uff0c\u6240\u4ee5\u4e0a\u8ff0\u4f8b\u5b50\u4e0d\u4f1a\u5339\u914d&#8221;http:\/\/example.com\/servicefoo.txt&#8221;\u8bf7\u6c42\u3002\u5bf9\u4e8e\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\uff0c\u8bf7\u53c2\u89c1<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#redirectmatch\">RedirectMatch<\/a><\/code>\u6307\u4ee4\u3002<\/p>\n<div>\n<h3>\u6ce8\u610f<\/h3>\n<p>\u91cd\u5b9a\u5411\u6307\u4ee4\u603b\u662f\u4f18\u5148\u4e8eAlias\u548cScriptAlias\u6307\u4ee4\uff0c\u800c\u65e0\u8bba\u4ed6\u4eec\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u987a\u5e8f\u5982\u4f55\u3002<\/p>\n<\/div>\n<p>\u5982\u679c\u6ca1\u6709\u6307\u5b9a<var>status<\/var>\u53c2\u6570\uff0c\u5219\u91cd\u5b9a\u5411\u662f&#8221;\u4e34\u65f6\u7684&#8221;(HTTP status 302)\u3002\u4e5f\u5c31\u662f\u5bf9\u5ba2\u6237\u7aef\u6765\u8bf4\uff0c\u6b64\u8d44\u6e90\u7684\u4f4d\u7f6e\u53d8\u52a8\u662f\u4e34\u65f6\u6027\u7684\u3002\u6b64<var>status<\/var>\u53c2\u6570\u53ef\u4ee5\u8fd4\u56de\u4ee5\u4e0bHTTP\u72b6\u6001\u7801\uff1a<\/p>\n<dl>\n<dt>permanent <\/dt>\n<dd>\u8fd4\u56de\u4e00\u4e2a\u6c38\u4e45\u6027\u91cd\u5b9a\u5411\u72b6\u6001\u7801(301)\uff0c\u8868\u793a\u6b64\u8d44\u6e90\u7684\u4f4d\u7f6e\u53d8\u52a8\u662f\u6c38\u4e45\u6027\u7684\u3002 <\/dd>\n<dt>temp <\/dt>\n<dd>\u8fd4\u56de\u4e00\u4e2a\u4e34\u65f6\u6027\u91cd\u5b9a\u5411\u72b6\u6001\u7801(302)\uff0c\u8fd9\u662f\u9ed8\u8ba4\u503c\u3002 <\/dd>\n<dt>seeother <\/dt>\n<dd>\u8fd4\u56de\u4e00\u4e2a&#8221;\u53c2\u89c1&#8221;\u72b6\u6001\u7801(303)\uff0c\u8868\u793a\u6b64\u8d44\u6e90\u5df2\u7ecf\u88ab\u66ff\u4ee3\u3002 <\/dd>\n<dt>gone <\/dt>\n<dd>\u8fd4\u56de\u4e00\u4e2a&#8221;\u5df2\u5e9f\u5f03&#8221;\u72b6\u6001\u7801(410)\uff0c\u8868\u793a\u6b64\u8d44\u6e90\u5df2\u7ecf\u88ab\u6c38\u4e45\u6027\u5730\u5220\u9664\u4e86\u3002\u5982\u679c\u6307\u5b9a\u4e86\u8fd9\u4e2a\u72b6\u6001\u7801\uff0c\u5219<var>URL<\/var>\u53c2\u6570\u5c06\u88ab\u5ffd\u7565\u3002 <\/dd>\n<\/dl>\n<p><var>status<\/var>\u53ef\u4ee5\u88ab\u6307\u5b9a\u4e3a\u6570\u5b57\u72b6\u6001\u4ee5\u8fd4\u56de\u5176\u4ed6\u72b6\u6001\u7801\u3002\u5982\u679c\u6b64\u72b6\u6001\u5728300-399\u4e4b\u95f4\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b<var>URL<\/var>\u53c2\u6570\uff0c\u5426\u5219\u5c06\u88ab\u5ffd\u7565\u3002\u6ce8\u610f\uff0c\u6b64\u72b6\u6001\u7801\u5fc5\u987b\u662fApache\u5df2\u77e5\u7684(\u53c2\u89c1http_protocol.c\u4e2d\u7684<code>send_error_response<\/code>\u51fd\u6570)\u3002<\/p>\n<div>\n<h3>\u793a\u4f8b\uff1a<\/h3>\n<p><code>Redirect permanent \/one http:\/\/example.com\/two<br \/>\nRedirect 303 \/three http:\/\/example.com\/other <\/code><\/p>\n<\/div>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<h2><a id=\"RedirectMatch\" name=\"RedirectMatch\">RedirectMatch<\/a> <a id=\"redirectmatch\" name=\"redirectmatch\">\u6307\u4ee4<\/a><\/h2>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u57fa\u4e8e\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u5bf9\u5f53\u524d\u7684URL\u53d1\u9001\u4e00\u4e2a\u5916\u90e8\u91cd\u5b9a\u5411<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Syntax\">\u8bed\u6cd5<\/a><\/th>\n<td><code>RedirectMatch [<var>status<\/var>] <var>regex<\/var> <var>URL<\/var><\/code><\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Context\">\u4f5c\u7528\u57df<\/a><\/th>\n<td>server config, virtual host, directory, .htaccess<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Override\">\u8986\u76d6\u9879<\/a><\/th>\n<td>FileInfo<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Module\">\u6a21\u5757<\/a><\/th>\n<td>mod_alias<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8be5\u6307\u4ee4\u4e0e<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#redirect\">Redirect<\/a><\/code>\u7b49\u6548\uff0c\u4f46\u662f\u5b83\u4f7f\u7528\u4e86\u6807\u51c6\u7684<a title=\"see glossary\" href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/glossary.html#regex\">\u6b63\u5219\u8868\u8fbe\u5f0f<\/a>\uff0c\u800c\u4e0d\u662f\u7b80\u5355\u7684\u524d\u7f00\u5339\u914d\u3002\u5982\u679c<var>regex<\/var>\u4e0eURL-path\u76f8\u5339\u914d\uff0c\u5219\u670d\u52a1\u5668\u4f1a\u628a\u6240\u5339\u914d\u7684\u62ec\u5f27\u4e2d\u7684\u5b57\u7b26\u4e32\u66ff\u6362\u5230\u8be5\u6307\u4ee4\u6240\u6307\u5b9a\u7684\u76ee\u6807\u5b57\u7b26\u4e32\u4e2d\uff0c\u5e76\u89c6\u4e4b\u4e3a\u4e00\u4e2a\u6587\u4ef6\u540d\u3002\u4f8b\u5982\uff0c\u91cd\u5b9a\u5411\u6240\u6709GIF\u6587\u4ef6\u5230\u53e6\u4e00\u4e2a\u670d\u52a1\u5668\u4e0a\u540c\u540d\u7684JPEG\u6587\u4ef6\uff0c\u53ef\u4ee5\uff1a<\/p>\n<div>\n<p><code>RedirectMatch (.*)\\.gif$ http:\/\/www.anotherserver.com$1.jpg <\/code><\/p>\n<\/div>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<h2><a id=\"RedirectPermanent\" name=\"RedirectPermanent\">RedirectPermanent<\/a> <a id=\"redirectpermanent\" name=\"redirectpermanent\">\u6307\u4ee4<\/a><\/h2>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u53d1\u9001\u4e00\u4e2a\u5916\u90e8\u6c38\u4e45\u91cd\u5b9a\u5411\u4f7f\u5ba2\u6237\u7aef\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u4e0d\u540c\u7684URL<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Syntax\">\u8bed\u6cd5<\/a><\/th>\n<td><code>RedirectPermanent <var>URL-path<\/var> <var>URL<\/var><\/code><\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Context\">\u4f5c\u7528\u57df<\/a><\/th>\n<td>server config, virtual host, directory, .htaccess<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Override\">\u8986\u76d6\u9879<\/a><\/th>\n<td>FileInfo<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Module\">\u6a21\u5757<\/a><\/th>\n<td>mod_alias<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6b64\u6307\u4ee4\u544a\u77e5\u5ba2\u6237\u7aef\u6b64\u91cd\u5b9a\u5411\u662f\u6c38\u4e45\u6027\u7684(status 301)\u3002\u4e0e&#8221;<code>Redirect permanent<\/code>&#8220;\u7b49\u6548\u3002<\/p>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<h2><a id=\"RedirectTemp\" name=\"RedirectTemp\">RedirectTemp<\/a> <a id=\"redirecttemp\" name=\"redirecttemp\">\u6307\u4ee4<\/a><\/h2>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u53d1\u9001\u4e00\u4e2a\u5916\u90e8\u4e34\u65f6\u91cd\u5b9a\u5411\u4f7f\u5ba2\u6237\u7aef\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u4e0d\u540c\u7684URL<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Syntax\">\u8bed\u6cd5<\/a><\/th>\n<td><code>RedirectTemp <var>URL-path<\/var> <var>URL<\/var><\/code><\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Context\">\u4f5c\u7528\u57df<\/a><\/th>\n<td>server config, virtual host, directory, .htaccess<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Override\">\u8986\u76d6\u9879<\/a><\/th>\n<td>FileInfo<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Module\">\u6a21\u5757<\/a><\/th>\n<td>mod_alias<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6b64\u6307\u4ee4\u544a\u77e5\u5ba2\u6237\u7aef\u6b64\u91cd\u5b9a\u5411\u53ea\u662f\u4e34\u65f6\u6027\u7684(status 302)\u3002\u4e0e&#8221;<code>Redirect temp<\/code>&#8220;\u7b49\u6548\u3002<\/p>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<h2><a id=\"ScriptAlias\" name=\"ScriptAlias\">ScriptAlias<\/a> <a id=\"scriptalias\" name=\"scriptalias\">\u6307\u4ee4<\/a><\/h2>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u6620\u5c04\u4e00\u4e2aURL\u5230\u6587\u4ef6\u7cfb\u7edf\u5e76\u89c6\u4e4b\u4e3aCGI\u811a\u672c<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Syntax\">\u8bed\u6cd5<\/a><\/th>\n<td><code>ScriptAlias <var>URL-path<\/var> <var>file-path<\/var>|<var>directory-path<\/var><\/code><\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Context\">\u4f5c\u7528\u57df<\/a><\/th>\n<td>server config, virtual host<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Module\">\u6a21\u5757<\/a><\/th>\n<td>mod_alias<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><code>ScriptAlias<\/code>\u6307\u4ee4\u7684\u884c\u4e3a\u4e0e<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#alias\">Alias<\/a><\/code>\u6307\u4ee4\u76f8\u540c\uff0c\u4f46\u540c\u65f6\u5b83\u53c8\u6807\u660e\u6b64\u76ee\u5f55\u4e2d\u542b\u6709\u5e94\u8be5\u7531cgi-script\u5904\u7406\u5668\u5904\u7406\u7684CGI\u811a\u672c\u3002\u4ee5<var>URL-path<\/var>\u5f00\u5934\u7684(%\u5df2\u89e3\u7801\u7684)\u7684URL\u4f1a\u88ab\u6620\u5c04\u5230\u7531\u7b2c\u4e8c\u4e2a\u53c2\u6570\u6307\u5b9a\u7684\u5177\u6709\u5b8c\u6574\u8def\u5f84\u540d\u7684\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u811a\u672c\u3002<\/p>\n<div>\n<h3>\u793a\u4f8b\uff1a<\/h3>\n<p><code>ScriptAlias \/cgi-bin\/ \/web\/cgi-bin\/ <\/code><\/p>\n<\/div>\n<p>\u5bf9<code>http:\/\/myserver\/cgi-bin\/foo<\/code>\u7684\u8bf7\u6c42\u4f1a\u5f15\u5bfc\u670d\u52a1\u5668\u6267\u884c<code>\/web\/cgi-bin\/foo<\/code>\u811a\u672c\u3002<\/p>\n<div><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#page-header\"><img decoding=\"async\" src=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/images\/up.gif\" alt=\"top\" \/><\/a><\/div>\n<h2><a id=\"ScriptAliasMatch\" name=\"ScriptAliasMatch\">ScriptAliasMatch<\/a> <a id=\"scriptaliasmatch\" name=\"scriptaliasmatch\">\u6307\u4ee4<\/a><\/h2>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#aaaaaa\">\n<tbody>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Description\">\u8bf4\u660e<\/a><\/th>\n<td>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6620\u5c04\u4e00\u4e2aURL\u5230\u6587\u4ef6\u7cfb\u7edf\u5e76\u89c6\u4e4b\u4e3aCGI\u811a\u672c<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Syntax\">\u8bed\u6cd5<\/a><\/th>\n<td><code>ScriptAliasMatch <var>regex<\/var> <var>file-path<\/var>|<var>directory-path<\/var><\/code><\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Context\">\u4f5c\u7528\u57df<\/a><\/th>\n<td>server config, virtual host<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Status\">\u72b6\u6001<\/a><\/th>\n<td>\u57fa\u672c(B)<\/td>\n<\/tr>\n<tr>\n<th><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/directive-dict.html#Module\">\u6a21\u5757<\/a><\/th>\n<td>mod_alias<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8be5\u6307\u4ee4\u4e0e<code><a href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/mod\/mod_alias.html#scriptalias\">ScriptAlias<\/a><\/code>\u7b49\u6548\uff0c\u4f46\u662f\u5b83\u4f7f\u7528\u4e86\u6807\u51c6\u7684<a title=\"see glossary\" href=\"http:\/\/man.chinaunix.net\/newsoft\/Apache2.2_chinese_manual\/glossary.html#regex\">\u6b63\u5219\u8868\u8fbe\u5f0f<\/a>\uff0c\u800c\u4e0d\u662f\u7b80\u5355\u7684\u524d\u7f00\u5339\u914d\u3002\u5982\u679c<var>regex<\/var>\u4e0eURL-path\u76f8\u5339\u914d\uff0c\u5219\u670d\u52a1\u5668\u4f1a\u628a\u6240\u5339\u914d\u7684\u62ec\u5f27\u4e2d\u7684\u5b57\u7b26\u4e32\u66ff\u6362\u5230\u8be5\u6307\u4ee4\u6240\u6307\u5b9a\u7684\u76ee\u6807\u5b57\u7b26\u4e32\u4e2d\uff0c\u5e76\u89c6\u4e4b\u4e3a\u4e00\u4e2a\u6587\u4ef6\u540d\u3002\u4f8b\u5982\uff0c\u8981\u4f7f\u7528\u6807\u51c6\u7684<code>\/cgi-bin<\/code> \uff0c\u53ef\u4ee5\uff1a<\/p>\n<div>\n<p><code>ScriptAliasMatch ^\/cgi-bin(.*) \/usr\/local\/apache\/cgi-bin$1 <\/code><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4ece\u4e00\u4e2a\u57df\u540d\u6539\u5230\u53e6\u4e00\u4e2a\u57df\u540d\uff0c\u6216\u8005\u5bf9\u670d\u52a1\u5668\u7684\u76ee\u5f55\u7ed3\u6784\u8fdb\u884c\u8c03\u6574\u65f6\uff0c\u4f60\u7684\u7528&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-324","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/posts\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/comments?post=324"}],"version-history":[{"count":3,"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/posts\/324\/revisions"}],"predecessor-version":[{"id":326,"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/posts\/324\/revisions\/326"}],"wp:attachment":[{"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/media?parent=324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/categories?post=324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elon.852128.com\/blog\/wp-json\/wp\/v2\/tags?post=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}