2012-11-02 60 views
1

我有移動Magento到另一臺服務器的問題。Magento自動將我從子目錄重定向到主域

舊服務器地址: oldserver.com/shop

新服務器地址: newserver.com/shop

我做的舊服務器數據庫和FTP文件的備份和我上傳的文件,並導入數據庫到新服務器。用新的數據庫細節更改local.xml文件後Magento後端工作正常,但我從前端重定向奇怪的問題。當我進入newserver.com/shop時,我可以在一瞬間看到我的商店主頁,並自動將我重定向到主域:newserver.com。

我曾試圖改變地址管理面板中: 基本URL:{{BASE_URL}} - >http://newdomain.com/shop/ 基地鏈接網址:{{unsecure_base_url}} - >http://newdomain.com/shop

,並與其他編輯字段相同和'安全'標籤編輯。它不起作用,仍然將我從商店目錄重定向到主域。 在oldserver字段{{unsecure_base_url}}默認沒有newserver.com/shop,並且它正常工作。

我試圖刷新/禁用所有的Magento緩存安裝後仍然無法正常工作。

我試圖在newdomain.com目錄中安裝乾淨的Magento,一切都很好,它不會將我重定向到主域。任何想法是怎麼回事? :)

我的.htaccess文件是:在db表core_config_data

DirectoryIndex index.php 

<IfModule mod_php5.c> 
php_flag magic_quotes_gpc off 
php_flag session.auto_start off 
php_flag suhosin.session.cryptua off 
php_flag zend.ze1_compatibility_mode Off 
</IfModule> 

<IfModule mod_security.c> 
SecFilterEngine Off 
SecFilterScanPOST Off 
</IfModule> 

<IfModule mod_deflate.c> 
</IfModule> 

<IfModule mod_ssl.c> 
SSLOptions StdEnvVars 
</IfModule> 

<IfModule mod_rewrite.c> 
Options +FollowSymLinks 
RewriteEngine on 
#RewriteBase /magento/ (I have tried to change it to /shop/ and uncomment and still redirect me) 
#RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L] 
## rewrite API2 calls to api.php (by now it is REST only) 
RewriteRule ^api/rest api.php?type=rest [QSA,L] 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
RewriteCond %{REQUEST_METHOD} ^TRAC[EK] 
RewriteRule .* - [L,R=405] 
#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$ 
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] 
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302] 
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule .* index.php [L] 
</IfModule> 
+0

看起來像代碼中的東西做重定向...做一個grep ... – FlorinelChis

回答

1

檢查安全和不安全Magento的路徑。

清潔

/var/cache/* 
/var/session/* 
/var/log/* 

,並清理瀏覽器緩存。

最後檢查是否設置了根目錄下的.htaccess中的RewriteBase。

+0

我檢查了core_config_data表和路徑都OK - 與後端面板相同。我清理了以上目錄,仍然是一樣的。在根目錄中我沒有.htaccess文件。當我安裝Magento的乾淨安裝,它工作正常。也許我會重新安裝,複製主題並手動配置,或者你有更好的主意?我的本地主機和共享主機上存在同樣的問題。 – user1794955

0

如果您的magento安裝的根目錄中沒有.htaccess,您應該添加它。 您不需要執行新的全新安裝。

1

不幸的是,今天我有一個新的magento項目同樣的問題。 :-) 請檢查表core_config_date中的每一行。 Web安全和不安全的路徑可能會出現多次。

0

我問在oldserver.com/shop上創建這個主題的公司到移動Magento。現在它在新服務器上工作,但新服務器有點慢,所以當我進入newdomain.com/shop時,我可以看到頁面的標題:404,並且比Magento將automaticaly重定向到「家」類別中的一個類別。我認爲我的問題是因爲之前Magento重定向到主域時,沒有找到主頁,現在他們設置類別的重定向。我希望它對未來的任何人都有用。