<?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; rewrite</title>
	<atom:link href="http://laoyu.info/archives/tag/rewrite/feed" rel="self" type="application/rss+xml" />
	<link>http://laoyu.info</link>
	<description>Dreams are hard to follow,but dont let anyone tear them away!Hold on!</description>
	<lastBuildDate>Thu, 21 Jul 2011 15:51:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>折腾很久才搞定的一个Apache的Rewrite规则</title>
		<link>http://laoyu.info/archives/542.html</link>
		<comments>http://laoyu.info/archives/542.html#comments</comments>
		<pubDate>Sat, 25 Jul 2009 15:14:02 +0000</pubDate>
		<dc:creator>老余</dc:creator>
				<category><![CDATA[技术·学习]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[rewrite]]></category>

		<guid isPermaLink="false">http://laoyu.info/archives/542.html</guid>
		<description><![CDATA[今天碰到了一个Apache的重写url的问题,需求是这样的,把 /abc/hello.html?page=2 rewrite成 /search.php?key=hello&#38;page=2 我自己尝试写规则如下 ^abc/(.+)\.html\?page=([0-9]+)$ /search.php/?key=$1&#38;page=$2 这个规则怎么尝试都无法成功,就是不能匹配上那个问号. 实在搞不定只好利用网络请教高手了,记录过程如下 1.先到我加的几个qq群里问,自认为这种方式较快,因为这些qq群在线都是好几十人,随便碰到个会的就帮我搞定了.结果让我很失望,发了4个qq群,只有一个群里得到了答复,而且答案跟我的写法一样. 2.到百度知道提问,一个小时后得到一个答复跟我自己写的一样,仍然没搞定. 3.到国内一个很大的论坛发贴求助,只有一个人答复 &#34;你悬偿点分嘛..重赏之下,必有勇夫&#34;,我以为帮助别人即使没有所谓的&#34;分&#34;也很快乐. 4.转战国外论坛,在webmasterworld以interrogation rewrite 为关键字搜索到了www.webmasterworld.com/apache/3375528.htm,虽然没有找到我要的答案,但是知道了apache的rewrite有个叫query_string的东西 5.在百度以关键词query string rewrite搜索到了我想要的结果http://stauren.net/log/4b8atjdnw.html 说白了就是一个参数的问题那就是[L,QSA] 摘抄一段那位网友的文章 RewriteEngine on # Rewrite current-style URLs of the form 'index.php?q=x'. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 第1行： 如果服务器加载了rewrite模块，则执行如下规则 第2行： 打开改写引擎，不用动，加上就好。 第3行： 注释 第4行： RewriteCond 表示这是应用改写规则的条件，%{REQUEST_FILENAME}表示对请求的文件完整url进行判断，-f是表示这是普通文件，!表示非。这句的意思就是，如果请求的不是普通文件，则对url进行改写。 第5行： 基本同第4行，-d的意思是文件夹 第 6行：RewriteRule 表示这是改写规则，^(.*)$是一个正则，表示整个请求的url（在RewriteBase [...]]]></description>
		<wfw:commentRss>http://laoyu.info/archives/542.html/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

