Home > Uncategorized > Migrating a classic ASP site from Windows to Linux

Migrating a classic ASP site from Windows to Linux

I recently moved javatiger.com from a Windows server to a Linux server, basically, to move some smaller sites off the main Windows server, and
I had spare VPS server that I could use for the purpose.

First step to set up Apache on the Linux server,

Use WinSCP to create files in
/etc/apache2/sites-enabled/omadataobjects.com.conf
 
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerAlias www.omadataobjects.com
DocumentRoot
/var/www/omadataobjects.com
</VirtualHost>
 
Use Putty to restart Apache /etc/init.d/apache2
reload

The site was in ASP, was indexed in Google, with Page Rank, so I didn’t want to change the URLs, so I wanted to use mod_rewrite,
which I installed using Putty:

root@vps ~ # a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.
root@vps ~ # /etc/init.d/apache2 force-reload
Forcing reload of web server (apache2)… waiting .

I then created a .htaccess file in the website root

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*).asp$ /$1.php [L,NC,R=301]
</IfModule>

Which rewrites all .asp requests to .php

I then changed the extension of all .asp files to .php,
and changed
<!–#include file="header.asp"–> to <?php include("header.php"); ?>

Oh, and I had a few glitches with case-sensitivity, which Windows is less strict about.

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: