Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping to PHP Files

Status
Not open for further replies.

baden100

Programmer
Apr 26, 2006
10
US
We changed our website from .php to .net, and now several search engines still have the .php files (which are now broken links) in their db.

What I want to do is create those .php files that contain .Net code and execute them.

I have written:

Code:
<%@ Language=VBScript %> 
<% 
'
' index2.php
'
Response.Status="301 Moved Permanently" 
Response.AddHeader("Location", "[URL unfurl="true"]http://www.mysite.com/index.aspx")[/URL]
%>

I've also set up a PHP file type for the server, and set the execution path
(Website/properties/Home Directory/Configuration/Mappings)

Using the old ASP dll, "C:\WINDOWS\system32\inetsrv\asp.dll", the redirect works fine using Response.Redirect... in the code.

However, when using
c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll

The browser displays the code without executing it.


Can someone lend a hand?


Thank you.
 
This might work for you.

In your web.config file, set the customErrors element up something like this:

Code:
<customErrors mode = "On">
   <error statusCode = "404" redirect = "errorPage.aspx" />
</customErrors>

Then in the code-behind of the page "errorPage.aspx" perform the compiled code equivalent of your VBScript.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top