Solved

301 Redirects from ASPX to PHP files on IIS server

Posted on 2011-03-16
5
501 Views
Last Modified: 2012-05-11
Hello Experts,

I have been tasked with converting an existing ASP.net (.aspx) site running on IIS to a PHP site running on IIS.  I can't use another Web server as there are some back-end items that are still in asp.net.  

My question is this:  What is the best way to do 301 Permanently Moved redirects?  I've read a bunch about using the .htaccess file in Apache, but not sure how to do this in IIS.  Also, the names of the pages are not going to be the same, and we have shrunk the site so many of the old aspx pages will go to the same php file.

Is there a way to do this in one file as in using the .htaccess?  The only other solution I can think of is to maintain all the aspx pages and do a response.redirect in each.  I was hoping to avoid doing that if possible.

Many thanks!

Ike1492
0
Comment
Question by:ike1492
5 Comments
 
LVL 15

Accepted Solution

by:
pcsmitpra earned 500 total points
ID: 35149076
Step to 301 Redirection : IIS - website -> properties - > Home Directory -> A redirection to URL -> Mention Destination website name -> Select permanent redirection option -> Apply -> Ok -> Ok .
You are done , To see the step by step with more details please visit : http://www.highposition.net/301-redirect-tutorial-iis/
0
 
LVL 2

Expert Comment

by:DerekStone
ID: 35149099
You'll likely want to create (or find on the Web) an ASP.NET HttpModule that does redirection. The module get's configured in "web.config", and can use regular expressions or an XML file, for example, to do the mappings. Basically the module will "intercept" requests that it can rewrite (to a different URL). Luckily you're going from ASP.NET to PHP, which means the pages people are redirecting from (*.aspx) will still be fed through the ASP.NET pipeline, so this will work in IIS6 as well. IIS7 has an "integrated pipeline", meaning the modules will work regardless of the file extension (i.e. on non-ASP.NET pages).
0
 

Author Comment

by:ike1492
ID: 35150253
pcsmitpra:  I understand that this can be done when one URL is being redirected to another - thanks!  In my case, the URL will remain the same, and individual aspx pages will need to be permanently moved to their php counterpart, and in a one to many fashion.

Ex.  www.xxxx.com/product1.aspx --> www.xxxx.com/product1.php
    & www.xxxx.com/product2.aspx --> www.xxxx.com/product1.php

I hope this helps clarify things.

Many thanks!

Ike1492
0
 
LVL 11

Expert Comment

by:b_levitt
ID: 35151574
If this is IIS6 you should be able to use a wildcard redirect:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/41c238b2-1188-488f-bf2d-464383b1bb08.mspx?mfr=true

Nearly your exact senario is spelled out in the example for the $0 thru $9 variables.

A more powerful rules engine exists in IIS7 but there is no user interface (you'll need to modify the web.config).  Just above the samples section there is a similar example to what you want to do:
http://www.iis.net/ConfigReference/system.webServer/httpRedirect#006

0
 

Author Closing Comment

by:ike1492
ID: 35724109
not what I was looking for
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now