<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OurApache &#187; 404</title>
	<atom:link href="http://ourapache.com/archives/tag/404/feed" rel="self" type="application/rss+xml" />
	<link>http://ourapache.com</link>
	<description>我们致力于一个Apache知识的分享网站</description>
	<lastBuildDate>Tue, 13 Apr 2010 05:18:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>让apache支持自定义404页面错误</title>
		<link>http://ourapache.com/archives/136</link>
		<comments>http://ourapache.com/archives/136#comments</comments>
		<pubDate>Thu, 12 Feb 2009 08:09:48 +0000</pubDate>
		<dc:creator>OurApache</dc:creator>
				<category><![CDATA[Apache解错方案]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[rewrite]]></category>

		<guid isPermaLink="false">http://www.ourapache.com/?p=136</guid>
		<description><![CDATA[在rewrite开启的情况下，当URL发起请求的页面在服务器端不存在的时候，返回http status code ==400;
而通常文件没有找到应该返回404状态码，查询N久无解中，关闭rewrite一切正常]]></description>
			<content:encoded><![CDATA[<p>在rewrite开启的情况下，当URL发起请求的页面在服务器端不存在的时候，返回http status code ==400;<br />
而通常文件没有找到应该返回404状态码，查询N久无解中，关闭rewrite一切正常</p>
<p>在VirtualHost内部使用 ErrorDocument <a href="http://ourapache.com/archives/tag/404" class="st_tag internal_tag" rel="tag" title="标签 404 下的日志">404</a> /notfound.php  当服务器响应为404的时候会自动跳转到notfound.php<br />
为了适应多种浏览器的不同 /notfound.php最好使用绝对的HTTP开头，如：http://blog.daxi8.cn/notfound.php</p>
<p>可以使用 .htaccess文件关闭 RewriteEngine Off 来关闭在此目录的rewrite模块</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li>2009年06月14号 -- <a href="http://ourapache.com/archives/255" title="常见的rewrite规则大全">常见的rewrite规则大全</a></li><li>2009年02月16号 -- <a href="http://ourapache.com/archives/140" title="Apache、resin、rewrite泛域名、多域名设置">Apache、resin、rewrite泛域名、多域名设置</a></li><li>2009年02月10号 -- <a href="http://ourapache.com/archives/106" title="Apache Rewrite 规则详解">Apache Rewrite 规则详解</a></li><li>2009年02月7号 -- <a href="http://ourapache.com/archives/85" title="apache之404错误页面">apache之404错误页面</a></li><li>2008年12月27号 -- <a href="http://ourapache.com/archives/13" title="单独编译apache的rewrite模块">单独编译apache的rewrite模块</a></li></ul>
	标签：<a href="http://ourapache.com/archives/tag/404" title="404" rel="tag">404</a>, <a href="http://ourapache.com/archives/category/debug" title="Apache解错方案" rel="tag">Apache解错方案</a>, <a href="http://ourapache.com/archives/tag/rewrite" title="rewrite" rel="tag">rewrite</a><br />
]]></content:encoded>
			<wfw:commentRss>http://ourapache.com/archives/136/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache之404错误页面</title>
		<link>http://ourapache.com/archives/85</link>
		<comments>http://ourapache.com/archives/85#comments</comments>
		<pubDate>Sat, 07 Feb 2009 12:20:03 +0000</pubDate>
		<dc:creator>OurApache</dc:creator>
				<category><![CDATA[Apache基础知识]]></category>
		<category><![CDATA[404]]></category>

		<guid isPermaLink="false">http://www.ourapache.com/?p=85</guid>
		<description><![CDATA[404错误其实就是我们经常见到的找不到文件的错误，但是那是默认的效果，很难看。
有时候我们需要的这样的功能：我们要记录下来404是的页面时哪些，更有些时候我需要判断404页面是不是本来系统应该生成的静态页面但是没有生成成功的，如果是，我们应该生成这个静态页面，然后把生成的静态页面返回给用户。]]></description>
			<content:encoded><![CDATA[<p>404错误其实就是我们经常见到的找不到文件的错误，但是那是默认的效果，很难看。</p>
<p>有时候我们需要的这样的功能：我们要记录下来404是的页面时哪些，更有些时候我需要判断404页面是不是本来系统应该生成的静态页面但是没有生成成功的，如果是，我们应该生成这个静态页面，然后把生成的静态页面返回给用户。</p>
<p>我要处理的逻辑就是：把404错误跳转到一个页面，我们取名叫：missing404.php</p>
<p>然后再这个页面中实现我们需要的功能。</p>
<p>首先定义跳转：在虚拟站点定义中使用如下语句即可。</p>
<p>ErrorDocument <a href="http://ourapache.com/archives/tag/404" class="st_tag internal_tag" rel="tag" title="标签 404 下的日志">404</a> http ://www.ithom.cn</p>
<p>定义完成后的虚拟站点如下</p>
<p>&lt;VirtualHost *:80&gt;</p>
<p>     ServerAdmin     master</p>
<p>      DocumentRoot @ithom.cn/usr/local/apache/htdocs/www.ithom.cn</p>
<p>      ServerName <a href="http://www.ithom.cn">www.ithom.cn</a></p>
<p>      ServerAlias     ithom.cn</p>
<p>      ErrorLog logs/blogguy.cn_err_log</p>
<p>      CustomLog logs/blogguy.cn-access_log2 common</p>
<p>      ErrorDocument 404 <a href="http://www.ithom.cn">http://www.ithom.cn</a><br />
     &lt;IfModule mod_limitipconn.c&gt;</p>
<p>      &lt;Location /upimg/soft&gt;</p>
<p>         MaxConnPerIP 5</p>
<p>     &lt;/Location&gt;</p>
<p>      &lt;/IfModule&gt;</p>
<p>&lt;/VirtualHost&gt;</p>
<p>在missing404.php中的处理将另外说明</p>
<p>这里再提供另外一种方法，但是不推荐，以为比较耗资源，使用 .htaccess 来重定向</p>
<p>在 .htaccess 中加入</p>
<p>ErrorDocument 404 /404.html</p>
<p>不要以为就此完了，你可能会发现404.html根本跳转不到他上面去，嘿嘿，原因是你的404.html文件太小了，IE认为找不到，又是404错误。如果404.html的小于512字节的话，那么IE会认为这个错误页面不够“友好”，会忽视掉的。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li>2009年02月12号 -- <a href="http://ourapache.com/archives/136" title="让apache支持自定义404页面错误">让apache支持自定义404页面错误</a></li></ul>
	标签：<a href="http://ourapache.com/archives/tag/404" title="404" rel="tag">404</a>, <a href="http://ourapache.com/archives/category/basic" title="Apache基础知识" rel="tag">Apache基础知识</a><br />
]]></content:encoded>
			<wfw:commentRss>http://ourapache.com/archives/85/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

