
How to Transfer a Joomla Website From a Linux Server to a Windows Server
Ah, the joys of Windows.
If you’re like most Joomla Developers, you’ll probably never have to touch a Window server or even recognise the term “IIS”. Say what?
Exactly.
Microsoft is rather a different beast from our beloved Linux, and every once in a while you may be faced with a client on Windows hosting and will therefore be forced to tame and pander to the whims of Mr Gates’ legacy.
This tutorial will lead you around the pitfalls to the golden gates of success.
So let’s get started.
- Copy your Joomla website files (on your Linux hosting) and transfer them via FTP to your Windows hosting.
- Export your database via PHPMyAdmin (on your Linux hosting), and import via PHPMyAdmin on your new Windows hosting.
- Make sure your hosting provider has either IIS URL Rewrite Module (for IIS 7 and is free to download and install on your IIS7 webserver), or ISAPI_Rewrite (or a similar third-party add-on).
- Ensure that the IIS URL Rewrite Module is looking for your .htaccess file (yes, you read that right. .htaccess on a Windows server can play nice if you’ve got the IIS URL Rewrite Module or similar, in place). If your IIS URL Rewrite Module is expecting your .htaccess file to be called something else, be sure to rename your .htaccess file accordingly to match.
- Make sure the $live_site entry in your configuration.php is completed with your website URL (remember to add the trailing slash):
- var $live_site = ‘https://www.webholism.com/’;
- Open the index.php file in your Joomla root (the main Joomla folder), and add the below lines just after the opening <?php tag
if (isset($_SERVER[‘HTTP_X_REWRITE_URL’]))
{
$_SERVER[‘REQUEST_URI’] = $_SERVER[‘HTTP_X_REWRITE_URL’];
}
If you’re using SH404SEF, you may need to have the following settings:
- Site -> Global Configuration -> Site tab:
- Search Engine Friendly URLs = Yes
- Use URL rewriting = Yes
- Other options in this area = No
- Components -> Sh404SEF -> Control Panel
- Enable URL optimization = Yes
- Rewriting mode = With .htaccess (mod_rewrite)
- Activate security functions = Yes
If you’re using an alternative SEF extension, you may need to follow their setup procedure.
To remove index.php from the SEF URL’s, Windows needs a little help to do this.
- Open your web.config file (should be in your Joomla root folder).
- Paste the following code below the opening <system.webServer> tag:
<rewrite>
<rules>
<rule name=”Redirect index.php” stopProcessing=”true”>
<match url=”index\.php/(.*)” />
<action type=”Redirect” url=”{R:1}” appendQueryString=”false” />
</rule>
<rule name=”Rewrite index.php”>
<match url=”(.*)” />
<conditions>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
</conditions>
<action type=”Rewrite” url=”index.php/{R:1}” />
</rule>
</rules>
</rewrite>
You should now be pretty much sorted for SEF URL’s. Hurrah, you clever thing you!