<?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>Mingshi &#187; asp</title>
	<atom:link href="http://www.mingshi.info/tag/asp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mingshi.info</link>
	<description>miaomiao</description>
	<lastBuildDate>Thu, 11 Aug 2011 05:36:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>asp/php实现在http和https之间跳转</title>
		<link>http://www.mingshi.info/aspphp%e5%ae%9e%e7%8e%b0%e5%9c%a8http%e5%92%8chttps%e4%b9%8b%e9%97%b4%e8%b7%b3%e8%bd%ac/</link>
		<comments>http://www.mingshi.info/aspphp%e5%ae%9e%e7%8e%b0%e5%9c%a8http%e5%92%8chttps%e4%b9%8b%e9%97%b4%e8%b7%b3%e8%bd%ac/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 09:47:18 +0000</pubDate>
		<dc:creator>Stanley</dc:creator>
				<category><![CDATA[网站技术]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.mingshi.info/?p=363</guid>
		<description><![CDATA[ASP： 以https开始，请在该ASP页面顶部添加如下代码： &#60;% Response.Buffer = True If (Request.ServerVariables(&#8220;HTTPS&#8221;) = &#8220;off&#8221;) Then Dim xredir__, xqstr__ xredir__ = &#8220;https://&#8221; &#38; Request.ServerVariables(&#8220;SERVER_NAME&#8221;) &#38; _ Request.ServerVariables(&#8220;SCRIPT_NAME&#8221;) xqstr__ = Request.ServerVariables(&#8220;QUERY_STRING&#8221;) if xqstr__ &#60;&#62; &#8220;&#8221; Then xredir__ = xredir__ &#38; &#8220;?&#8221; &#38; xqstr__ Response.redirect xredir__ End if %&#62; 相反的，强迫以Http开始 &#60;% Response.Buffer = True If (Request.ServerVariables(&#8220;HTTPS&#8221;) = &#8220;on&#8221;) Then Dim xredir__, xqstr__ [...]]]></description>
			<content:encoded><![CDATA[<p>ASP：<br />
以https开始，请在该ASP页面顶部添加如下代码：<br />
&lt;%<br />
Response.Buffer = True<br />
If (Request.ServerVariables(&#8220;HTTPS&#8221;) = &#8220;off&#8221;) Then<br />
Dim xredir__, xqstr__<br />
xredir__ = &#8220;https://&#8221; &amp; Request.ServerVariables(&#8220;SERVER_NAME&#8221;) &amp; _<br />
Request.ServerVariables(&#8220;SCRIPT_NAME&#8221;)<br />
xqstr__ = Request.ServerVariables(&#8220;QUERY_STRING&#8221;)<br />
if xqstr__ &lt;&gt; &#8220;&#8221; Then xredir__ = xredir__ &amp; &#8220;?&#8221; &amp; xqstr__<br />
Response.redirect xredir__<br />
End if<br />
%&gt;<br />
相反的，强迫以Http开始<br />
&lt;%<br />
Response.Buffer = True<br />
If (Request.ServerVariables(&#8220;HTTPS&#8221;) = &#8220;on&#8221;) Then<br />
Dim xredir__, xqstr__<br />
xredir__ = &#8220;http://&#8221; &amp; Request.ServerVariables(&#8220;SERVER_NAME&#8221;) &amp; _<br />
Request.ServerVariables(&#8220;SCRIPT_NAME&#8221;)<br />
xqstr__ = Request.ServerVariables(&#8220;QUERY_STRING&#8221;)<br />
if xqstr__ &lt;&gt; &#8220;&#8221; Then xredir__ = xredir__ &amp; &#8220;?&#8221; &amp; xqstr__<br />
Response.redirect xredir__<br />
End if<br />
%&gt;</p>
<p>PHP：<br />
如果网页使用https访问，在网页开头加入以下代码：</p>
<p>&lt;?php</p>
<p>//http转化为https</p>
<p>if ($_SERVER["HTTPS"]&lt;&gt;&#8221;on&#8221;)</p>
<p>{   $xredir=&#8221;https://&#8221;.$_SERVER["SERVER_NAME"].</p>
<p>$_SERVER["REQUEST_URI"];   header(&#8220;Location: &#8220;.$xredir);</p>
<p>}</p>
<p>?&gt;</p>
<p>如果网页使用http访问，在网页开头加入以下代码：</p>
<p>&lt;?php</p>
<p>//https转化为http</p>
<p>if ($_SERVER["HTTPS"]==&#8221;on&#8221;)</p>
<p>{   $xredir=&#8221;http://&#8221;.$_SERVER["SERVER_NAME"].</p>
<p>$_SERVER["REQUEST_URI"];   header(&#8220;Location: &#8220;.$xredir);</p>
<p>}</p>
<p>?&gt;</p>
<p><a href="http://www.bshare.cn/share?url=http%3A%2F%2Fwww.mingshi.info%2Faspphp%25e5%25ae%259e%25e7%258e%25b0%25e5%259c%25a8http%25e5%2592%258chttps%25e4%25b9%258b%25e9%2597%25b4%25e8%25b7%25b3%25e8%25bd%25ac%2F&title=asp%2Fphp%E5%AE%9E%E7%8E%B0%E5%9C%A8http%E5%92%8Chttps%E4%B9%8B%E9%97%B4%E8%B7%B3%E8%BD%AC" title="用bShare分享或收藏本文"><img src="http://static.bshare.cn/frame/images/button_custom1-zh.gif" alt="用bShare分享或收藏本文" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mingshi.info/aspphp%e5%ae%9e%e7%8e%b0%e5%9c%a8http%e5%92%8chttps%e4%b9%8b%e9%97%b4%e8%b7%b3%e8%bd%ac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

