<?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; 301</title>
	<atom:link href="http://ourapache.com/archives/tag/301/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>.htaccess的301跳转</title>
		<link>http://ourapache.com/archives/310</link>
		<comments>http://ourapache.com/archives/310#comments</comments>
		<pubDate>Sat, 12 Dec 2009 15:35:29 +0000</pubDate>
		<dc:creator>OurApache</dc:creator>
				<category><![CDATA[Apache基础知识]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[跳转]]></category>

		<guid isPermaLink="false">http://www.ourapache.com/?p=310</guid>
		<description><![CDATA[.htaccess的301跳转]]></description>
			<content:encoded><![CDATA[<p>server:linux(ubuntu)</p>
<p>add mod_rewrite:1、sudo a2enmod rewrite 2、udo vim /etc/apache2/sites-enabled/000-default</p>
<p>将其中的：</p>
<p>AllowOverride None</p>
<p>修改为：</p>
<p>AllowOverride All</p>
<p>重启生效。</p>
<p>将 htmldata.cn 转换为 www.htmldata.cn</p>
<div class="codecolorer-container text " style="overflow: auto; white-space: nowrap;">
<div class="text codecolorer" style="white-space: nowrap;">
<table style="table-layout: fixed; border: #cccccc 1px dotted;" border="0" cellspacing="0" cellpadding="6" width="95%" align="center">
<tbody>
<tr>
<td style="word-wrap: break-word;" bgcolor="#f3f3f3"><span style="font-weight: bold;">以下是引用片段：</span><br />
Options +FollowSymlinks<br />
RewriteEngine on<br />
rewritecond %{http_host} ^htmldata.cn [nc]<br />
rewriterule ^(.*)$ http://www.htmldata.cn/$1 [r=<a href="http://ourapache.com/archives/tag/301" class="st_tag internal_tag" rel="tag" title="标签 301 下的日志">301</a>,nc]</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li>2010年03月9号 -- <a href="http://ourapache.com/archives/316" title="htaccess二级目录重写找不到路径">htaccess二级目录重写找不到路径</a></li><li>2009年06月15号 -- <a href="http://ourapache.com/archives/259" title="16个简单实用的.htaccess小贴示">16个简单实用的.htaccess小贴示</a></li><li>2009年02月7号 -- <a href="http://ourapache.com/archives/97" title="使用apache下的301设置来做域名的更换转移">使用apache下的301设置来做域名的更换转移</a></li><li>2009年01月6号 -- <a href="http://ourapache.com/archives/32" title="htaccess学习笔记">htaccess学习笔记</a></li><li>2009年01月6号 -- <a href="http://ourapache.com/archives/25" title="Apache服务器使用.htaccess实现图片防盗链方法教程">Apache服务器使用.htaccess实现图片防盗链方法教程</a></li><li>2008年12月27号 -- <a href="http://ourapache.com/archives/7" title="apache中.htaccess的功能及写法">apache中.htaccess的功能及写法</a></li></ul>
	标签：<a href="http://ourapache.com/archives/tag/301" title="301" rel="tag">301</a>, <a href="http://ourapache.com/archives/category/basic" title="Apache基础知识" rel="tag">Apache基础知识</a>, <a href="http://ourapache.com/archives/tag/htaccess" title="htaccess" rel="tag">htaccess</a>, <a href="http://ourapache.com/archives/tag/%e8%b7%b3%e8%bd%ac" title="跳转" rel="tag">跳转</a><br />
]]></content:encoded>
			<wfw:commentRss>http://ourapache.com/archives/310/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用apache下的301设置来做域名的更换转移</title>
		<link>http://ourapache.com/archives/97</link>
		<comments>http://ourapache.com/archives/97#comments</comments>
		<pubDate>Sat, 07 Feb 2009 12:41:33 +0000</pubDate>
		<dc:creator>OurApache</dc:creator>
				<category><![CDATA[Apache初级应用]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[域名]]></category>

		<guid isPermaLink="false">http://www.ourapache.com/?p=97</guid>
		<description><![CDATA[页面永久性移走（301重定向）是一种“自动转向”技术。当您的域名变更后，比如网站以前用的域名是www.xingmo.com.cn，现在要用www.xingmo.cn ，这时就要用到这个技术了。]]></description>
			<content:encoded><![CDATA[<p>页面永久性移走（301重定向）是一种“自动转向”技术。当您的域名变更后，比如网站以前用的域名是www.xingmo.com.cn，现在要用www.xingmo.cn ，这时就要用到这个技术了。</p>
<p>您可能也会说，我可以用php的header函数，javascript的meta refresh,window.location.href来做转向，但建议不要这么做。这么做可能会被搜索引擎认为是在作弊，从而影响网站排名。</p>
<p>在Apache中，可以用<strong>.<a href="http://ourapache.com/archives/tag/htaccess" class="st_tag internal_tag" rel="tag" title="标签 htaccess 下的日志">htaccess</a></strong>来设置并实现301重定向的功能。</p>
<p>Redirect permanent / http://www.xingmo.cn/ (将根目录下的内容重定向到http://www.xingmo.cn/ )<br />
redirect permanent /index.php http://www.xingmo.cn/index.php?go=category_6(将网页index.php重定向到<a href="http://www.xingmo.cn/index.php?go=category_6">http://www.xingmo.cn/index.php?go=category_6</a>)</p>
<p>通过合理地配置重定向参数中的正则表达式，可以实现更复杂的匹配。</p>
<p><span style="font-size: 12px;"><strong>PHP下的301重定向</strong></span></p>
<p>&lt;? php<br />
Header( “HTTP/1.1 <a href="http://ourapache.com/archives/tag/301" class="st_tag internal_tag" rel="tag" title="标签 301 下的日志">301</a> Moved Permanently” ) ;<br />
Header( “Location: http://www.xingmo.cn” );<br />
?&gt;</p>
<p><span style="font-size: 12px;"><strong>旧域名重定向到新域名</strong></span></p>
<p>创建一个.htaccess文件，并将下面提供的代码写入文件内，它可以确保旧域名所有的目录或者网页正确的跳转到新域名内。</p>
<p>记住.htaccess文件一定要放在旧网站的根目录下，并且新网站要和旧网站保持相同的目录结构及网页文件</p>
<div class="code">
Options +FollowSymLinks<br />
RewriteEngine on<br />
RewriteRule (.*) http://www.xingmo.cn/$1 [R=301,L]<br />
 </div>
<p> 将这个文件保存为.htaccess放在原www.xingmo.com.cn网站的根目录下。</p>
<p>请将上面的www.xingmo.cn修改成你想要跳转到的域名。<br />
此外，我建议大家归总旧网站的外部链接，并联系相应的站点修改导入链链的URL，以指向新站点。</p>
<p>注意：.htaccess文件只有在使用安装有Mod Rewrite模块的Apache作为WEB服务器的Linux主机上才能起作用</p>
<p><span style="font-size: 12px;"><strong><a href="http://ourapache.com/archives/tag/%e5%9f%9f%e5%90%8d" class="st_tag internal_tag" rel="tag" title="标签 域名 下的日志">域名</a>301重定向到www的二级域名</strong></span></p>
<p>创建一个.htaccess文件，并将下面提供的代码写入文件内，它可以确保所有来自对xingmo.cn的请求都转向到对www.xingmo.cn进行请求。记住.htaccess文件一定要放在旧网站的根目录下，并且新网站要和旧网站保持相同的目录结构及网页文件<br />
 <br />
Options +FollowSymlinks<br />
RewriteEngine on<br />
rewritecond %{http_host} ^xingmo.cn [nc]<br />
rewriterule ^(.*)$ http://www.xingmo.cn/$1 [r=301,nc]<br />
 </p>
<p>请将上面的<span style="color: #444444;">http://www.xingmo.cn/</span>修改成你想要跳转到的域名。</p>
<p>注意：.htaccess文件只有在使用安装有Mod Rewrite模块的Apache作为WEB服务器的Linux主机上才能起作用。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li>2009年12月12号 -- <a href="http://ourapache.com/archives/310" title=".htaccess的301跳转">.htaccess的301跳转</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月12号 -- <a href="http://ourapache.com/archives/134" title="泛域名与mod_rewrite">泛域名与mod_rewrite</a></li></ul>
	标签：<a href="http://ourapache.com/archives/tag/301" title="301" rel="tag">301</a>, <a href="http://ourapache.com/archives/category/primary" title="Apache初级应用" rel="tag">Apache初级应用</a>, <a href="http://ourapache.com/archives/tag/%e5%9f%9f%e5%90%8d" title="域名" rel="tag">域名</a><br />
]]></content:encoded>
			<wfw:commentRss>http://ourapache.com/archives/97/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

