Magento自动将我从子目录重定向到主域

时间:2012-11-02 17:44:23

标签: magento redirect subdirectory

将Magento移动到另一台服务器时遇到问题。

旧服务器地址: oldserver.com/shop

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

我从旧服务器备份数据库和FTP文件,我上传文件并将数据库导入新服务器。使用新的数据库详细信息更改local.xml文件后,Magento后端工作正常,但我从前端重定向有奇怪的问题。当我进入newserver.com/shop时,我可以在瞬间看到我的商店主页,而不是自动将我重定向到主域名:newserver.com。

我尝试在管理面板中更改地址: 基本网址:{{base_url}} - > http://newdomain.com/shop/ 基本链接网址:{{unsecure_base_url}} - > http://newdomain.com/shop

和其他编辑字段以及“安全”标签编辑相同。它不起作用,仍然将我从商店目录重定向到主域。 在旧服务器字段{{unsecure_base_url}}是默认情况下没有newserver.com/shop并且它正常工作。

我尝试在安装后刷新/禁用所有Magento缓存,但仍无效。

我曾尝试在newdomain.com目录中安装干净的Magento,一切都很好,它不会将我重定向到主域。有什么想法发生了什么? :)

我的.htaccess文件是:

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>

4 个答案:

答案 0 :(得分:1)

检查db table core_config_data中的安全和不安全的magento路径。

清洁

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

并清理浏览器的缓存。

最后检查root中.htaccess中的RewriteBase是否已设置。

答案 1 :(得分:1)

不幸的是,今天我遇到了一个新的magento项目同样的问题。 :-) 请检查表core_config_date中的每一行。 Web安全和不安全路径可以出现多次。

答案 2 :(得分:0)

如果magento安装的根目录中没有.htaccess,则应添加它。 您无需进行新的全新安装。

答案 3 :(得分:0)

我问过在oldserver.com/shop创建这个主题的公司移动Magento。现在它在新服务器上运行,但是新服务器有点慢,所以当我进入newdomain.com/shop时,我可以看到页面标题:404,而不是Magento自动重定向到“home”类别之一。我认为我的问题是因为在没有找到主页之前Magento重定向到主域名之前,现在他们设置了一个类别的重定向。我希望将来对任何人都有用。

相关问题