0

I could do with a bit advice on moving a Magento site.I am sceptical this is even a good move but my client insists I give it a try for him as I think the existing host is proving too expensive. I have no previous experience of Magento but have moved dozens of websites in the past so know the usual issues. I was asked to move this one by a former client who has the live site hosted on a VPS and to which I have no access and if my (non technical) client has access he doesn't seem to be aware. He can access the admin area and I have been given access to that. I was sent the site files and database ( both massive as it seems his current host didn't try to clear the caches or generally tidy things up before zipping the lot and giving it to my client.) I copied all the files up. No problems there. I loaded the database. Edited the local.xml file to point to my new database server and with appropriate credentials. As I am currently running on my hosting and the live site still has dns I have been forced to make a couple of hacks to try get access directly from my own machine 1) entry in hosts 2) I have to accept the usual insecure connection nags and try force connection over http ( for now) My problem is I get either 404s (usually) or by editing the .htaccess ( see below) and taking out some lines somtimes 301 redirects endin gin errors saying too many redirects.

There were .htaccess files came in with the site and I can see a heap of rules in there but even manipulating these doesn't resolve the issue.

I have temporarily edited the local.xml file to give me a simpler admin path for testing but this too fails to a 404. So I have no admin access.

I am not sure if I am fighting some config that was in to make it run on the VPS or if its a config issue with the new site versus the old site's rewrite rules. I have seen various guides to moving magento sites (both here and elsewhere) and have done the all the changes I would expect to make and also trawled the database looking for config in 'core_config_data' that might be causing issues. I have no errors in my error log other than stuff saying some comments using "#" are deprecated in php 5.4, I don't think these are a functional issue ( no file is specified for this error) and am struggling. example error in log though think its not relevant to my issue: www.[hostname].co.uk [Thu Feb 22 22:54:38 2018] [error] [client 95.x.y.z:44668] PHP Deprecated: Comments starting with '#' are deprecated in /usr/php54/etc/php.ini on line 367 in Unknown on line 0

I have cleared the cache directories and log directories and local cookies numerous times.

Is there anything above that suggests I have missed something? This is the .htaccess file

############################################
## 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 64M
    php_value memory_limit 256M
# Adding more zeroes at the end makes this better
    php_value max_execution_time 180000     

############################################
## 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 /magento/

############################################
## uncomment next line to enable light API calls processing

#    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]

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

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

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

############################################
## redirect for mobile user agents

    #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]

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

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

# Redirect /fancy2/index.php/ ghost urls away
    RewriteCond %{REQUEST_URI} ^/fancy2/index.php/(.*)$
    RewriteRule ^ /%1 [L,R=301]

############################################
# Custom fancydress logic to always remove index.php from urls
#    RewriteCond %{THE_REQUEST} ^.*/index.php
#    RewriteCond %{THE_REQUEST} !^.*/index.php/admin
#    RewriteCond %{THE_REQUEST} !^.*/index.php/banners
#    RewriteCond %{THE_REQUEST} !^.*/index.php/dataimport
#    RewriteCond %{THE_REQUEST} !^.*/index.php/admin
#    RewriteCond %{THE_REQUEST} !^.*/index.php/api/xmlrpc
#    RewriteRule ^index\.php/(.+)$ /$1 [R=301,L]
##edited out for testing
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_METHOD} !=POST
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
############################################
## 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

###########################################
## Deny access to release notes to prevent disclosure of the installed Magento version

    <Files RELEASE_NOTES.txt>
        order allow,deny
        deny from all
    </Files>

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

    #FileETag none

#<ifModule mod_expires.c>
  #ExpiresActive On
  #ExpiresDefault "access plus 1 seconds"
  #ExpiresByType text/html "access plus 1 seconds"
  #ExpiresByType image/gif "access plus 604800 seconds"
  #ExpiresByType image/jpeg "access plus 604800 seconds"
  #ExpiresByType image/png "access plus 604800 seconds"
  #ExpiresByType image/x-icon "access plus 604800 seconds"
  #ExpiresByType text/css "access plus 604800 seconds"
  #ExpiresByType text/javascript "access plus 604800 seconds"
  #ExpiresByType application/x-javascript "access plus 604800 seconds"
  #ExpiresByType image/svg+xml "access plus 604800 seconds"
#</ifModule>


#<ifModule mod_deflate.c>
        #AddOutputFilterByType DEFLATE text/plain
        #AddOutputFilterByType DEFLATE text/xml
        #AddOutputFilterByType DEFLATE application/xhtml+xml
        #AddOutputFilterByType DEFLATE text/css
        #AddOutputFilterByType DEFLATE application/xml
        #AddOutputFilterByType DEFLATE application/x-javascript
        #AddOutputFilterByType DEFLATE application/x-httpd-php
        #AddOutputFilterByType DEFLATE text/html
        #AddOutputFilterByType DEFLATE text/javascript
        #AddOutputFilterByType DEFLATE image/svg+xml
#</ifModule>

#<ifModule mod_gzip.c>
  #mod_gzip_on Yes
  #mod_gzip_dechunk Yes
  #mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  #mod_gzip_item_include handler ^cgi-script$
  #mod_gzip_item_include mime ^text/.*
  #mod_gzip_item_include mime ^application/x-javascript.*
  #mod_gzip_item_include mime ^image/svg+xml$
  #mod_gzip_item_exclude mime ^image/.*
  #mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
#</ifModule>

#<ifModule mod_headers.c>
  #<filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
  #  Header set Cache-Control "max-age=604800, public"
  #</filesMatch>
  #<filesMatch "\\.(css|css.gz)$">
  #  Header set Cache-Control "max-age=604800, public"
  #</filesMatch>
  #<filesMatch "\\.(js|js.gz)$">
  #  Header set Cache-Control "max-age=604800, private"
  #</filesMatch>
  #<filesMatch "\\.(xml|txt)$">
  #  Header set Cache-Control "max-age=216000, public, must-revalidate"
  #</filesMatch>
  #<FilesMatch "\.(svg|svgz)$">
  #  Header append Vary Accept-Encoding
  #</FilesMatch>
#</ifModule>

###########################################
## Deny access to cron.php
    <Files cron.php>

############################################
## uncomment next lines to enable cron access with base HTTP authorization
## http://httpd.apache.org/docs/2.2/howto/auth.html
##
## Warning: .htpasswd file should be placed somewhere not accessible from the web.
## This is so that folks cannot download the password file.
## For example, if your documents are served out of /usr/local/apache/htdocs
## you might want to put the password file(s) in /usr/local/apache/.

        #AuthName "Cron auth"
        #AuthUserFile ../.htpasswd
        #AuthType basic
        #Require valid-user

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

        Order allow,deny
        Deny from all

    </Files> 

<IfModule mod_setenvif.c>
     <IfModule mod_headers.c>

         ############################################
         # X-Content-Type-Options: nosniff disable content-type sniffing on some browsers.
         Header set X-Content-Type-Options: nosniff

         ############################################
         # This header forces to enables the Cross-site scripting (XSS) filter in browsers (if disabled)
         BrowserMatch \bMSIE\s8 ie8
         Header set X-XSS-Protection: "1; mode=block" env=!ie8

     </IfModule>
</IfModule>

There is a line saying edited for testing the 4 lines below, here I have tried commenting them out to see if it made a difference. With them as is I get 404's in my Access log and am dropped to an error page. The line about ghost urls I suspect relates maybe to a staging install used when the original site was set up on the VPS .

Any help the community can offer I would be most grateful.

  • Compare vs github.com/OpenMage/magento-mirror/blob/magento-1.9/.htaccess and see if diff. Also, how much is too much for a VPS, has your client considered companies such as DigitalOcean and OVH? – Ricky Odin Matthews Feb 23 '18 at 13:53
  • I have found the problem & it is now running. There was it seems some corruption of the database that was exported from the existing host & though the sql.zip loaded without errors at my end, it appears it never contained all the tables that should have been there. We managed to gain access to the live host today & do a dump in cli then direct server to server transfer and its all working. I have pointed the client at several hosting alternatives ( most of which would mean them taking their business elsewhere but would rather they had the full picture) but they don't seem to want to do this. – Kenny Halley Feb 23 '18 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.