2012-11-19 148 views
1

我在這裏有與http://wordpress.org/support/topic/help-pointing-to-wordpressindexhtml-does-not-work相同的問題,但這不是解決和關閉的話題。wp htaccess重定向301 index.html到主頁

該網站有一個靜態的html實時站點和在WordPress CMS轉移,所以在SEO關係是需要的index.html是在WP主頁http://mysite.com/dev/重定向,但是當我把它重定向使用redirect 301瀏覽器閃錯誤(The page isn't redirecting properly )。請注意:我正在使用自定義永久鏈接插件將.html擴展程序包含在內頁中。

我知道有很多人在這裏有足夠的經驗,請大家幫忙

回答

1

刪除所有手動.htaccess修改和安裝重定向插件:http://wordpress.org/extend/plugins/redirection/

轉到工具>重定向並進入一個新的reidrection

來源網址:/myblog/index.html 目標網址:/ myblog/

+0

我試過這個插件,它很棒。方便。 – jho1086

0

嘗試這些:

PHP:

<? 
Header("HTTP/1.1 301 Moved Permanently"); 
Header("Location: http://www.site.com/dev/"); 
?> 

的.htaccess:

Options +FollowSymlinks 
RewriteEngine on 
rewritecond %{http_host} ^yoursite.com [nc] 
rewriterule ^(.*)$ http://www.yoursite.com/dev/$1 [r=301,nc] 
+0

哦,我忘了說明這一點,我正在開發我的開發文件夾中的wordpress版本,但如果全部設置了,我將以root身份進行傳輸。 – jho1086

1

我還是儘量答案在這裏http://wordpress.org/support/topic/help-pointing-to-wordpressindexhtml-does-not-work,我發現,它正在工作我只是忘了刪除我第一次嘗試的路線。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.html?$ /dev/ [NC,R=301,L]#this line do the tricks
RewriteBase /dev/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /dev/index.php [L]
</IfModule>

,所以如果我在根目錄下的文件傳輸,我將只是刪除了開發/。