views:

9

answers:

1

Hi there,

I'm using Rackspace's Cloud Sites as a webhost and, for a site that uses both PHP and ASP, they have a funny setup.

On our setup, PHP is the default technology, and so the site by default runs Apache, until it hits a URL ending with the .asp extension. That means this URL:

www.site.com/folder/

Will not automatically load:

www.site.com/folder/index.asp

Can .htaccess do the same thing, say with something like this?

RewriteCond %{REQUEST_FILENAME}index.asp -f

RewriteRule (.*/) $1index.asp [R=301,QSA]

In English, that means, "If the current URI + index.asp is a real file, redirect to that file." The above doesn't work; am I doing something wrong, or is it just impossible?

It's weird, I know, but as I say, it's required by Rackspace's setup.

Other alternatives I'm looking at include manually creating index.php files in folders with index.asp files, which will redirect to the index.asp files, but I'm hoping to avoid that if possible. :)

BTW, DirectoryIndex doesn't work in this situation.

A: 

I went ahead and added index.php files in each of the folders that had index.asp.

The files have this code:

<?php header("HTTP/1.1 301 Moved Permanently"); header("Location: index.asp"); exit(); ?>

That's a workable solution for us, since we don't have many index.asp files.

Nabha