Posted in: 張貼在:
1,480 views 1480的意見
Please note: This page was originally written in English.請注意:此頁中,原本以英文書寫。
The original post can be viewed原來的文章可以看 here這裡 . 。
Please note: This page was originally written in English.
The text has been translated using an online service such as Google or Babelfish.
The original post can be viewed here.
If you are not using 301 Redirects you are making a blogging mistake.如果您使用的不是301重定向你是一個blogging的決策失誤。 301 Redirects are easy to setup, save your google pagerank and link love, and save your visitors from a nasty “Error 404 - Not Found” page. 301重定向是容易安裝,節省您的Google PageRank和鏈接的愛,並保存您的訪問者從一個惡劣的“錯誤404 -未找到”頁。 What is a 301 redirect?什麼是301重定向? It’sa single line you add to you “.htaccess” file (more on this later) that says ‘anyone that visits that URL - send them to that URL instead’.這是單行您添加到你“ 。 htaccess的”文件(了解更多關於本更新)說, '任何訪問該網址-將它們發送給該網址不是' 。 The redirect can happen witin your site, you can redirect to an external site - it’s basically from any URL to any URL.重定向可以發生witin您的網站,您可以重定向到外部網站-它基本上是從任何網址的任何網址。
Here are some scenarios where you would use a 301 redirect:這裡有一些情況下,你會使用301重定向:
- You’ve changed your permalink structure您改變您的永久結構
- You’ve accidentally deleted a post and need to recreate it您意外刪除的職位,並需要重新
- You wish to change the post slug (url) to make it more seo friendly你是否想改變後的塞器( URL ) ,使其更加徐友好
- You have a bunch of 404’s for pages that don’t (and maybe never) existed你有一群404的網頁不(也許永遠)存在
- You recently moved from one blogging platform to another (drupal, blogger, movable type, etc., to wordpress)您最近提出的從一個博客到另一個平台( drupal時, Blogger ,活字等,在WordPress )
- You changed, recreated, or renamed your categories你改變,重現,或重新命名您的類別
If you’re using Wordpress, you can try and install a module to add redirects directly from your admin panel.如果您使用的WordPress ,您可以嘗試並安裝一個模塊添加重定向直接從您的管理面板。 I personally have not had luck with this plugin, but some have - you’re welcome to try the我個人都沒有運氣,與此插件,但有些人-歡迎您嘗試 Objection Redirection Wordpress 301 Redirect Plugin反對重定向的WordPress 301重定向插件 and see if it works for you.看看是否適合您。
If it doesn’t (or if you’re not using Wordpress), you’ll need to edit your .htaccess file yourself.如果它沒有(或如果您不是使用的WordPress ) ,您需要編輯您的。 htaccess的檔案自己。 If using Wordpress, you should already have a file called “.htaccess” in the root of your web site.如果使用的WordPress ,你應該已經有一個名為“ 。 htaccess的: ”在網站的根目錄。 If not, you’ll need to create it.如果不是,您需要創建它。 Open up any text editor (notepad) on your PC.打開任何文本編輯器(記事本)在您的PC上。 You’ll need an FTP account and FTP access to your web site to do this.您需要一個FTP帳戶和FTP訪問您的網站做到這一點。 If using Wordpress, download your .htaccess file.如果使用的WordPress ,下載您的。 htaccess的文件。 It should already look something like this:現在應該已經看起來就像這樣:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . <ifmodule mod_rewrite.c> rewriteengine對rewritebase / rewritecond % ( request_filename ) ! - F的rewritecond % ( request_filename ) !三維rewriterule 。 /index.php [L] </IfModule> /的index.php [升] < / ifmodule >
If you’re not using Wordpress, download your .htaccess file and open it (or create a new one if you don’t have one already).如果您不是使用的WordPress ,下載您的。 htaccess的文件,並打開它(或創建一個新如果您沒有一已) 。 Basically - you’re going to add one line for each redirect.基本上是-您要添加一條線為每個重定向。 It’s very simple:它的很簡單:
Redirect 301 “/blog” http://www.yourwebsite.com重定向301 “ /博客” http://www.yourwebsite.com
Redirect 301 “/page.html” http://www.yourwebsite.com/page.html重定向301 “ / page.html上” http://www.yourwebsite.com/page.html
Redirect 301 “/subdir/oldpage.html” http://www.yourwebsite.com/subdir重定向301 “ / subdir / oldpage.html ” http://www.yourwebsite.com/subdir
Redirect 301 “/blog” http://www.anotherwebsite.com重定向301 “ /博客” http://www.anotherwebsite.com
I tried several ways to do this, and this is the one that works for me every time.我嘗試幾個方法可以做到這一點,這是一個工程,我每一次。 I’m hosted on a Linux server running Apache.我設於Linux服務器上運行的Apache 。 Every line starts with “Redirect 301 “.每行開頭為“重定向301 ” 。 Then (always in quotes) is the path on your server to redirect.然後(總是在引號)是路徑對您的服務器重定向。 I always start it with a slash (that means from the root of your site).我一向啟動它加上一個斜線, (即從源頭上您的網站) 。 There is no need to write out your full domain name in the first part.有沒有必要寫了你的完整域名在第一部分。 You can redirect a directory, a page, a page in a sub-directory, etc. Then just write the full URL to the page you are redirecting to.您可以重新導向目錄,網頁,網頁在一個小組目錄等,然後,只需寫完整的URL到該網頁您正在重定向到。 You can redirect to a page in your site, a sub-directory, or a page in a sub-directory.您可以重定向至一個網頁,在您的網站,一個分目錄,或一個網頁在一個小組的目錄。 You can even redirect from your site to another (external) web site.你甚至可以重定向從您的網站到另一個(外部)的網站。
That’s it!這樣就大功告成了! Save you file and FTP back to the root of your web site and you’re done!節省您的文件和FTP回的根源,您的網站和您就大功告成了!
The reason I had to setup some 301 Redirects is because I migrated one of my web sites from Drupal to Wordpress.我之所以要安裝一些301重定向是因為我遷移我的一個網站從drupal到的WordPress 。 With the date based permalink structure in Wordpress, the URL’s of all of my important pages with pagerank was screwed up.與日期為基礎的永久結構在WordPress ,網址的所有我的重要網頁的PageRank是擰了。 They say if you redirect a page that had google page rank (to a new page) the (old) page rank will be passed on to the new page.他們說,如果你重定向的網頁已在Google的網頁排名(到了新的一頁) (歲)的網頁排名將轉嫁到新的一頁。 I can’t verify this myself, because my redirects haven’t been in place long enough to tell.我不能確認這自己,因為我重新導向尚未到位,足夠長的告訴。 I will update after they’ve been online awhile.我將更新後,他們一直在網上一段時間。






















July 18th, 2007 at 11:46 am 2007年7月18日在上午11時46分
[...] On my personal blogging site JTPRATT’s Blogging Mistakes, I just wrote a post about setting up 301 redirects. [ … … ]對我個人的博客網站jtpratt的博客的錯誤,我只是寫了郵政成立301重定向。 If you don’t already know how to setup 301 directs, what they are, or how to use them - you [...]如果您不知道如何安裝301指示,他們是什麼,或如何使用它們-您[ … … ]
June 13th, 2008 at 9:03 pm 2008年6月13日在下午9點03分
Hello, I found your site while trying to find some advice on how to do 301 redirects.您好,我發現您的網站的同時,試圖找到一些意見,就如何做301重定向。 I just moved my blog from Blogger to Wordpress and need to forward the PR and links to the new blog.我只是提出我的博客從Blogger ,以在WordPress和需要提出了PR和鏈接到新的博客。
I tried your redirects but it actually works without the quotes.我想您的重定向,但實際上工程,不包括引號。
ie即
Redirect 301 /webpage.html重定向301 / webpage.html http://www.yourwebsite.com/anotherpage.html
Maybe it’sa different version of Apache or something?也許這是不同版本的Apache或一些呢?
Anyway thanks a bunch!無論如何,感謝一群!
JP太平紳士
JPs last blog post..太平紳士去年博客帖子.. Wordpress move almost complete!在WordPress動議幾乎完成!