Archive

Archive for June, 2009

Creating a virtual directory on Apache for Windows

I wanted to allow database downloads from my D: drive, but I got this 403 error, this is how I solved it in my Httpd.conf

Alias /db "D:sqldatabackups"

<Directory "D:sqldatabackups">

Options Indexes FollowSymLinks MultiViews

AllowOverride all

Order Deny,Allow

Deny from localhost

Allow from all

</Directory>

Hope this helps

 

Categories: Uncategorized

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.

Categories: Uncategorized