4

I'm trying to migrate a Joomla 2.5.6 site from one server to another. I have used scp to copy the files one for one across and taken a mysqldump of the database so I'm sure that the new server has a clone of the code.

The differences that I can identify with the original server are:

  • It had PHP5.5 installed (I'm using 7.1)
  • It used Apache 2.2.14 (I'm using 2.4.18)
  • It was not served on HTTPS (I'm using a valid LetsEncrypt cert)

When I load the home page I get an infinite loop of 303 errors, which at first seemed to be related to the languagefilter plugin, but also seem to be related to SEF.

SEF off and no languagefilter: Page loads, links broken
SEF off and languagefilter present: Infinite redirect loop

I'm unable to login to the admin dashboard so I can't use that to disable stuff. I have edited the SEF setting in the global config and when it is turned off the site shows (with the wrong template).

My Apache vhost looks like this:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    DocumentRoot /var/www/html/fmjock
    ServerName fmjock.mystery.co.za
    <Directory "/var/www/html/fmjock">
        AllowOverride All
        allow from all
        Options +Indexes
   </Directory>
SSLCertificateFile /etc/letsencrypt/live/fmjock.mystery.co.za/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/fmjock.mystery.co.za/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

I verified that Apache2 is respecting the .htaccess file and that it's the same as the one from the original server. The only file that is different is the global configuration where I changed the database details.

Edit: This happens with either HTTP or HTTPS and it's not a 301 redirect from non-secure to secure, wget shows that it's returning 303:

root@sites-available# wget fmjock.mystery.co.za
--2017-12-14 07:50:57--  http://fmjock.mystery.co.za/
Resolving fmjock.mystery.co.za (fmjock.mystery.co.za)... 77.68.74.51
Connecting to fmjock.mystery.co.za (fmjock.mystery.co.za)|77.68.74.51|:80... 
connected.
HTTP request sent, awaiting response... 303 See other
Location: http://fmjock.mystery.co.za/en/ [following]

2 Answers 2

2

The problem is likely your HTTPS redirect. You are likely redirecting to HTTPS at the beginning of your .htaccess file, and later redirecting to HTTP. Another scenario is when your Joomla website is set to use HTTPS, but there is a redirect to HTTP in the .htaccess file.

2
  • 2
    Thanks, I read through your awesome guide on getting it to work in Nginx (that would be my first preference) - thanks for that too! It's not a 301 between HTTP and HTTPS, it's a 303 which I think is created by the language filter.
    – Andy
    Commented Dec 14, 2017 at 7:54
  • 2
    It was a Joomla plugin (SSL redirect) that wanted SSL only on specific pages (not the homepage). Forcing Apache2 to redirect to HTTPS clashed with the plugin. Now I let the plugin decide what to be SSL.
    – Andy
    Commented Dec 14, 2017 at 10:17
1

Your problems could be related to a number of reasons:

  • PHP version (Joomla 2.5 is not built to run on PHP 7)
    • Try to set your new server to PHP 5.6 This is often done through your cPanel, or ask your hosting provider.
  • Error during transfer (missing or corrupt files)
    • Try using Akeeba Backup for the transfer. Version 4.7.7 should work on Joomla 2.5.
  • Old Joomla version.
  • Invalid code in your .htaccess file.
    • Code working on one server might cause errors on another server. Try renaming your .htaccess file to e.g. old.htaccess Remember to disable URL rewriting in your configuration.php file (public $sef_rewrite = '0';)

These are just generic solutions, but it's a good starting point. I think the first option (PHP version) is most likely to be the problem, depending on what extensions you have installed.

Hope this helps.

2
  • Hi, I downgraded to PHP5.6 but that didn't help. I've used scp to copy directly between servers so I don't think there is any chance of a corrupted file. The Joomla version works on the old server so I don't want to introduce a new change by upgrading the version until I have the new server working. I'm getting a 303 redirect, which I think is generated by PHP rather than the htaccess.
    – Andy
    Commented Dec 14, 2017 at 9:51
  • After downgrading to PHP5.6 I was able to login to the admin panel which let me disable the language filter. Then everything clicked into place, thanks!
    – Andy
    Commented Dec 14, 2017 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.