Support

Akeeba Backup for Joomla!

#41668 .htaccess file causing issues after migrated to another server

Posted in ‘Akeeba Backup for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
5.2
PHP version
8.3
Akeeba Backup version
latest

Latest post by nicholas on Monday, 03 March 2025 13:51 CST

5uwebsite

Hi there,

We tried to setup a template website with all the backend configurations we wanted, and installed a few extensions including the latest verion of Admin Tools Pro and Akeeba Backup Pro.

Then we use Akeeba to migrate the website to another server for a new project.

However, we realize that the styles and images all got lost on the new server.

After contacting server support, they were able to fix the problem by renaming the .htaccess file to something else. They also replied:

"

However, it only worked after disabling the .htaccess file.

The issue was causing because of a redirect rule and commented the rule from the .htaccess file and it is mentioned below.
----
##### RewriteEngine enabled - BEGIN
RewriteEngine On ---------------------> commented
##### RewriteEngine enabled - END

# PHP FastCGI fix for HTTP Authorization
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
##### RewriteBase set - BEGIN
RewriteBase / ---------------------> commented
##### RewriteBase set - END

##### HTTP to HTTPS redirection
## Since you have enabled HSTS the first redirection rule will instruct the browser to visit the HTTPS version of your
## site. This prevents unsafe redirections through HTTP.
RewriteCond %{HTTPS} !=on [OR] ---------------------> commented
RewriteCond %{HTTP:X-Forwarded-Proto} =http ---------------------> commented
RewriteRule .* https://example.com%{REQUEST_URI} [L,R=301] ---------------------> commented
----

"

 

May I know whether this is because of Admin Tools Pro or Akeeba Backup Pro? We don't have this problem for most websites' migration, but we do see this issue a few times when we use Akeeba Backup Pro to migrate the website to certain servers. Is there a specific server setting that is causing the issue?

 

Thank you very much!

nicholas
Akeeba Staff
Manager

RewriteEngine On ---------------------> commented

Um, so your host's support person unironically disabled the entire .htaccess file, including Joomla's own code for SEF URLs and all of the protection, without batting an eyelid. As the kids text these days: 🚩🚩🚩

This should've been a red flag to the support person. Having to disable SEF URLs on a Joomla, WordPress, Drupal, PrestaShop etc site is a strong indication that the problem has been misdiagnosed. The question is, was that an untrained support person, or is the host a really bad one? Let's find out.

Replace the contents of your .htaccess file with those from Joomla's htaccess.txt. Go to Global Configuration and enable Search Engine Friendly URLs and Use URL Rewriting. If that breaks your site, it means that your host has not enabled mod_rewrite on their server. Considering that this is fundamental server configuration with no security drawbacks, enabled by default on live servers for the past 25 years, and combined with the fact this was not explained to you (let alone enabling mod_rewrite not being offered to you as an alternative) it's a strong indication you should go to a different host.

If, however, that worked then your host is okay, you just happened upon an untrained support person. In this case, the actual process to solve your issue is, of course, documented. Do remember to first scroll all the way down to the .htaccess Maker page and replace the domain names with those of your new site.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

5uwebsite

Thank you very much for the excellent and detailed reply! Your post is always beyong our expectation! 

 

Yes the support first reported that there is no server configuration issues, and they admitted that they are not familiar with scripts or codes. Also sorry for my mis-representation. When we migrated the website via Akeeba Backup, we realized that pretty much all hostings are good to go, without any further configurations. However, for certain servers or host, it might have the issues that all the CSS/javascript are lost, for both frontend and backend. After checking, the files are all migrated and the path in the html source is correct, however, you simply can't load that file.

 

Then the admin renamed the original .htaccess file and used the one shipped with Joomla, and said that everything is back. And they advised us to contact the developer for more details. So far, to be fair, the support is OK, but of course they are not as knowledgible as you are.

 

So, this may happen if the domain name in the original .htaccess file is not updated after migrating using Akeeba Backup Pro? May I know the easiest way to solve this issue in the future? Just use the original Joomla .htaccess file, and then go to Admin Tools Pro to use .htaccess file Maker to re-generate one?

 

Thank you.

nicholas
Akeeba Staff
Manager

 Just use the original Joomla .htaccess file, and then go to Admin Tools Pro to use .htaccess file Maker to re-generate one?

Correct. This is the recommended approach when you are changing the subdirectory, subdomain, or domain your site is hosted into.

Restore replacing the .htaccess file with the default, using the option in the Site Setup page. After the restoration is complete go to Admin Tools, .htaccess Maker and scroll all the way to the bottom to set up the new domain name (and directory, if necessary0. Then click on Save and Create .htaccess file to generate the new file.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!