2013-06-21 29 views
1

我在根目錄中有一個電子商務網站,並且想將我的博客移動到一個子目錄。我成功地從另一個域名轉移到了這個域名,但是當我嘗試訪問博客主頁時,它會重定向到我的電子商務網站的主頁。想要在一個子目錄中運行wordpress並保持我的主站點在根目錄中分開

的電子商務網站 - http://www.heavytshirt.com 的博客地址 - http://www.heavytshirt.com/blog

在博客目錄中的.htaccess文件看起來是這樣的:

RewriteEngine on 
    RewriteBase/

    # BEGIN WordPress 
    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /blog/ 
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /blog/index.php [L] 
    </IfModule> 

    # END WordPress 

,並在根目錄下的.htaccess文件看起來像這樣:

DirectoryIndex /mm5/merchant.mvc?Screen=SFNT 

    RewriteEngine On 

    RewriteRule ^mm5/admin.mvc? - [L] 

    RewriteCond %{REQUEST_FILENAME} !-s 
    RewriteRule ^product/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1 [L] 

    RewriteCond %{REQUEST_FILENAME} !-s 
    RewriteRule ^category/([^/.]+).html$ /mm5/merchant.mvc?Screen=CTGY&Category_code=$1 [L] 

    RewriteCond %{REQUEST_FILENAME} !-s 
    RewriteRule ^product/([^/]+)/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Category_code=$1&Product_code=$2 [L] 

    RewriteCond %{REQUEST_FILENAME} !-s 
    RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=$1 [L] 

    ### End - Inserted by Miva Merchant 

    Options +FollowSymlinks 
    RewriteEngine On 
    RewriteCond %{http_host} ^heavytshirt.com [nc] 
    RewriteRule ^(.*)$ http://www.heavytshirt.com/$1 [r=301,nc] 


    # BEGIN WordPress 
    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /blog/ 
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /blog/index.php [L] 
    </IfModule> 

    # END WordPress 

目前我能夠輸入一個後續的子目錄並獲得一個寶ST - 我愛: http://www.heavytshirt.com/blog/category/summershirts/

我能做些什麼使博客主頁上來時http://www.heavytshirt.com/blog ,而不是有人類型的影響在​​www.heavytshirt.com

回答

0

主要網站我不希望成爲你的Apache配置,因爲我相信它可以很容易地在WordPress中配置。

進入您的WordPress管理面板,並移至Settings/General Settings

現在相應地更改WordPress Address (URL)Site Address (URL)的值。請閱讀this WordPress Codex article瞭解更多詳情。

+0

事情是,我不希望我的編輯主要的.htaccess因爲它控制了我的電子商務網站是如何工作的,我需要它不被打斷。我繼續嘗試了其他一些方法,比如將index.php的副本移動到根目錄並根據指示進行編輯,現在我無法訪問我的博客的任何頁面,即使我輸入了網址一直在變。我把所有的東西都改回了原來的樣子,現在什麼都不起作用。現在我陷入困境。 – user2510012

+0

您是否嘗試過編輯設置? – Bjoern

0

你的問題,是因爲你已經設置

DirectoryIndex /mm5/merchant.mvc?Screen=SFNT 

因爲/博客/是一個目錄,您已設置的匹配規則爲目錄索引/博客/(因爲該目錄確實存在)。

您將不得不將兩個重寫指令組合起來才能得到所需的結果(兩次都不需要RewriteEngine On)。

可能更好,您從頭開始逐行測試,以確保您獲得所需的結果。

我不能對此進行測試,但你的想法:

Options +FollowSymlinks 

RewriteEngine On 

RewriteBase/
RewriteRule ^mm5/admin.mvc? - [L] 
RewriteCond %{REQUEST_FILENAME} !-s 
RewriteRule ^product/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1 [L] 
RewriteCond %{REQUEST_FILENAME} !-s 
RewriteRule ^category/([^/.]+).html$ /mm5/merchant.mvc?Screen=CTGY&Category_code=$1 [L] 
RewriteCond %{REQUEST_FILENAME} !-s 
RewriteRule ^product/([^/]+)/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Category_code=$1&Product_code=$2 [L] 
RewriteCond %{REQUEST_FILENAME} !-s 
RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=$1 [L] 
RewriteCond %{http_host} ^heavytshirt.com [nc] 
RewriteRule ^(.*)$ http://www.heavytshirt.com/$1 [r=301,nc] 

RewriteBase /blog/ 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /blog/index.php [L] 
相關問題