Moving a site between Linux and Windows servers: the differences that break it

A site made only of HTML, CSS and JavaScript moves from Linux to Windows (or back) with no trouble. A site with PHP or a database usually works, but breaks in half a dozen places that are always the same: upper and lower case in file names, slashes in paths, the server’s configuration file and the database. Anyone who knows those places can finish the move in an afternoon.

This article is for people who already have the site and are changing its system. If you are still deciding which to choose, read Linux or Windows hosting first.

Where it usually breaks

Point On Windows On Linux What you see
Upper case in names Logo.PNG and logo.png are the same file. They are two different files. Images and styles that vanish only after the move.
Slash in paths Accepts \ and /. Only /. File-not-found errors in code that uses \.
Server configuration IIS reads the web.config file. Apache and LiteSpeed read .htaccess. Friendly-URL rules and redirects stop working.
Table names Not case sensitive. Case sensitive, by default. A query on Users fails if the table is called users.
Line endings CRLF. LF. Shell scripts that refuse to run.
Permissions By access lists. By numbers (for example 644 and 755). A 403 or 500 error on files that exist.

The order for a move without surprises

1 Copy files and database to the destination, without touching the live site. See moving a site by hand: files by FTP and the database.
2 Test before changing DNS. The hosts file on your computer lets you see the new site under the real domain. See testing a migrated site before changing the DNS.
3 Walk through the site with the error log open. Every missing image, every “page not found” and every 500 error points to one of the items in the table. See website errors explained.
4 Rewrite the URL rules. The rules in web.config cannot be copied: they are translated into .htaccess (or the other way round). See .htaccess for PHP projects.
5 Fix the permissions. On Linux the starting rule is 644 for files and 755 for folders. See error 403 and permissions.

What does not cross the border

Some technologies are tied to the system. Classic ASP and ASP.NET Framework run on Windows; ASP.NET Core runs on both, but has to be published for the target system. Databases in SQL Server or Access must be converted to MariaDB or PostgreSQL before moving to a Linux account. Windows scheduled tasks become cron jobs on Linux. If your site depends on one of these, the route to Windows is a VPS: see publishing a website on Windows Server with IIS.

Coming from Windows, the upper-case problem is the sneakiest. On your own computer everything works, because the system does not tell them apart. On Linux, a link to Images/Logo.png does not open a folder called images. Search the code for file references and compare them with the real names.
Put everything in lower case. File, folder and table names in lower case, with no spaces or accents, work on any system. It is the best prevention for the next move.

Moving a site from Windows to Linux and want a second opinion? Tell us what it uses.

Open a support ticket

SEE ALSO

Linux or Windows hosting: which does your site need?

Testing a migrated site before you change the DNS (the hosts file)

.htaccess for PHP projects: friendly URLs and redirects

Hosting migration

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from 5.940,00 Kz/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?