1

I am not an ASP programmer. People still use a link from a time when this system was built on PHP.

Old url: www.domain.com/shop/more.php

New url : www.domain.com/shop/more.asp

It now runs on a Windows server that doesn't have PHP installed. If I create the old PHP file then the user is asked to download the .php file when visiting.

My research has taken me to learn that I can fix this by editing the web.config file (in either the root or the folder of the page) but all my changes have either caused errors or done nothing.

I have also considered just making the default 404 page redirect to the correct page in question but my attempts have found the same result.

Does anyone have any insight? Is there a way to find out what version of ASP the site is running?

i.am.michiel
  • 10,281
  • 7
  • 50
  • 86
Tony
  • 31
  • 4
  • just to clarify: when people visit `www.domain.com/shop/more.php`, you want them to be hard redirected to `www.domain.com/shop/more.asp`? I ask because I can't tell if you're trying to completely cut off `more.php` or want some special handling for this depreciated webpage. If you want hard redirect, then trying to recreate the old php page serves no purpose. I guess I'm confused about how you want to route requests. – bob-the-destroyer Jul 13 '12 at 02:10
  • yes. I want people who visit `www.domain.com/shop/more.php` to be automatically redirected to `www.domain.com/shop/more.asp` – Tony Jul 13 '12 at 02:38

4 Answers4

0

You should be able to redirect with javascript if PHP doesn't work:

<script type="text/javascript">
   window.location = "more.asp";
</script>
nhalink
  • 486
  • 1
  • 4
  • 20
  • You're not understanding. PHP is not running on the server. If a user goes to the .PHP page they are asked to download the PHP file because the server doesn't know how to open the file. Putting a javascript redirect will not render. The solution has to be more global. Like a routing system. – Tony Jul 13 '12 at 08:19
0

Can't you use the web.config, the MS equavalent of .htaccess? http://msdn.microsoft.com/en-us/library/ms972974.aspx

nhalink
  • 486
  • 1
  • 4
  • 20
0

Use web.config for this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true" />
        <rewrite>
            <rules>
                <rule name="CanonicalHostNameRule" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^www\.example\.com/something.php" negate="true" />
                    </conditions>
                    <action type="Redirect" url="http://www.example.com/something.aspx" />
                </rule>
            </rules>
        </rewrite>
  </system.webServer>
</configuration>

Never used ASP in my life so this might not work but hopefully it'll lead you on the right track.

Good luck!

NINJA EDIT:

Just found this which might help?

<add name="en_index"
               redirect="Domain"
               ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
               virtualUrl="http://mysitename/en/(.*).php"
               redirectMode="Permanent"
               destinationUrl="http://mysitename/en/$1.aspx" />

Might help?

I paraphrased this from here (scroll down): http://our.umbraco.org/forum/core/general/14366-redirect-html-to-aspx

Again, good luck!

Michael Giovanni Pumo
  • 14,338
  • 18
  • 91
  • 140
-1

In that case you should install php on your IIS server => http://php.iis.net/ As far as I know you can't tell IIS to render php files as something else.

nhalink
  • 486
  • 1
  • 4
  • 20
  • Is it possible to install it without having to restart apache or access the server settings? – Tony Jul 13 '12 at 09:54
  • No, the server doesn't recognize the file-extension, so instead of parsing it it sends it to the user as a downloadable file. I was thinking of maybe using isapi but then again you have to install software. – nhalink Jul 13 '12 at 11:03