迁移后magento链接不工作(损坏)(服务器到服务器)

时间:2015-02-28 10:23:10

标签: .htaccess magento migration

我在迁移方面遇到了很多麻烦。 我已将测试版网站移至最终服务器: shopfair.eu/ 经过很多问题,我还有两个问题:

首先,所有页面都已损坏(无法访问),即 http://shopfair.eu/index.php/alimenti-ipocalorici/linea-lazero.html

我注意到如果我从栏中删除/index.php/该页面存在且正在运行

http://shopfair.eu/index.php/alimenti-ipocalorici/linea-lazero.html

另一个问题是我无法访问管理页面......似乎是由于同样的问题。

我认为它是.htaccess或重写问题。

提前致谢。

我的.htacces:

`############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi

#    Action php5-cgi /cgi-bin/php5-cgi
#    AddHandler php5-cgi .php

############################################
## GoDaddy specific options

#   Options -MultiViews

## you might also need to add this line to php.ini
##     cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini

############################################
## this line is specific for 1and1 hosting

    #AddType x-mapp-php5 .php
    #AddHandler x-mapp-php5 .php

############################################
## default index file

    DirectoryIndex index.php

<IfModule mod_php5.c>

############################################
## adjust memory limit

    php_value memory_limit 512M
    php_value max_execution_time 18000

############################################
## disable magic quotes for php request vars

    php_flag magic_quotes_gpc off

############################################
## disable automatic session start
## before autoload was initialized

    php_flag session.auto_start off

############################################
## enable resulting html compression

    #php_flag zlib.output_compression on

###########################################
# disable user agent verification to not break multiple image upload

    php_flag suhosin.session.cryptua off

###########################################
# turn off compatibility with PHP4 when dealing with objects

    php_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload

    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

</IfModule>

<IfModule mod_ssl.c>

############################################
## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    #Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    RewriteBase /shopfair.eu/

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>


############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

<IfModule mod_expires.c>

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresDefault "access plus 1 year"

</IfModule>

############################################
## By default allow all access

    Order allow,deny
    Allow from all

############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag none`

2 个答案:

答案 0 :(得分:0)

是的,你已经重写了问题。请确保您的.htaccess文件包含以下代码。如果没有,请改变它。

请检查.htaccess中的以下代码,

<IfModule mod_rewrite.c>

############################################

## enable rewrites

Options +FollowSymLinks
RewriteEngine on

############################################

##你可以把你的magento根文件夹放在这里  相对于Web根目录的##路径

#RewriteBase /magento (Your Magento Root Folder)

############################################

##取消注释下一行以启用轻型API调用处理

#RewriteRule ^ api /([a-z] [0-9a-z _] +)/?$ api.php?type = $ 1 [QSA,L]

############################################

##重写API2调用api.php(现在它只是REST)

RewriteRule ^api/rest api.php?type=rest [QSA,L]

############################################

## HTTP授权的解决方法   CGI环境中的##

 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################

##禁用TRACE和TRACK HTTP方法以防止XSS攻击

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]

############################################

##总是在这些文件夹中的丢失文件上发送404

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################

##永远不会重写现有的文件,目录和链接

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

############################################    ##将其他所有内容重写为index.php

RewriteRule .* index.php [L]

 </IfModule>

2)上述代码在许多项目中都很完美。如果它不能解决您的问题。尝试制作这样的.htaccess文件 - &gt; https://github.com/Creare/magento-htaccess/blob/master/.htaccess

如果您可以分享.htaccess,那么我会更好地解决您的问题。

问候。

答案 1 :(得分:0)

由于我的服务器上的禁用功能FollowSymLink和+ SymLinksIfOwnerMatch,我将以下代码添加到我的.htaccess

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

然后删除var / cache和var / session文件夹中的所有文件。

之后网站正在运行,但管理员现在似乎无法正常工作(空白页)。