<?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>大蕉 &#187; apache</title>
	<atom:link href="http://daozhao.goflytoday.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://daozhao.goflytoday.com</link>
	<description>大蕉，一种有益的水果。不过本blog并不是介绍大蕉。哈哈</description>
	<lastBuildDate>Tue, 31 Jan 2012 12:56:43 +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>通过设置.htaccess识别浏览器的语言重定向不同的页面</title>
		<link>http://daozhao.goflytoday.com/2010/01/browser-accept-language/</link>
		<comments>http://daozhao.goflytoday.com/2010/01/browser-accept-language/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 06:52:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>

		<guid isPermaLink="false">http://daozhao.goflytoday.com/?p=695</guid>
		<description><![CDATA[apache有一个强大的地址重写模块（Module mod_rewrite），这个模块的使用可以参照这里和这里。你也可以在google搜索这些设置。功能比较多，可以说只有你想不到没有做不到。 这个模块的一般用法... ]]></description>
			<content:encoded><![CDATA[<p>apache有一个强大的地址重写模块（Module mod_rewrite），这个模块的使用可以参照<a title="中文" href="http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_rewrite.html" target="_blank">这里</a>和<a title="英文" href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" target="_blank">这里</a>。你也可以在google搜索这些设置。功能比较多，可以说只有你想不到没有做不到。</p>
<p>这个模块的一般用法有如下几种：</p>
<p>1、这个模块一般都用于一些程序的框架对地址栏的重写。例如wordpress就用到这个模块对地址栏从写，实现固定连接。</p>
<p>2、根据用户访问的浏览器用户类型重定向到不同的页面，例如：如果用户使用手机访问的话重定向到wap页面等。</p>
<p>3、当网站目录结构发生该变的时候，使用rewirte可以解析旧有的连接跳转到新的连接。</p>
<p>现在我有一个想法就是想用mod_rewrite模块去判断用户的语言，根据用户浏览器的语言重定向到不同的页面静态页面。英文的用户跳转到英文的主页，中文的用户跳转到中文的主页。我在网上搜索了一番，发觉大家都习惯使用程序去判断用的语言再去跳转，或者在程序内根据用户语言输出不同的内容。经过不断搜索和尝试，最终我都发现如何设置mod_rewrite模块去做这个操作。</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">RewriteCond %{HTTP:Accept-Language} ^zh-cn.*$ [NC]</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">#RewriteCond %{HTTP_ACCEPT_LANGUAGE} ^zh-cn</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">RewriteRule ^/?$ “http\:\/\/www\.goflytoday\.com\/airline2\/abc_chi\.htm” [R=301,L]</div>
<p>RewriteCond %{HTTP:Accept-Language} ^zh-cn.*$ [NC]</p>
<p>RewriteRule ^/?$  index_cn.htm [R=301,L]</p>
<p>上边的写法就可以了。RewriteCond %{HTTP:XXXXX} 这种写法可以根据http头做出很多的判断。并不只是限于下边几个参数<br />
HTTP_USER_AGENT<br />
HTTP_REFERER<br />
HTTP_COOKIE<br />
HTTP_FORWARDED<br />
HTTP_HOST<br />
HTTP_PROXY_CONNECTION<br />
HTTP_ACCEPT<br />
<h3>看看其它文章</h3>
<ul class="related_post"></ul>
<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://daozhao.goflytoday.com/2010/01/browser-accept-language/' addthis:title='通过设置.htaccess识别浏览器的语言重定向不同的页面 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://daozhao.goflytoday.com/2010/01/browser-accept-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

