Solved

301 Redirects from ASPX to PHP files on IIS server

Posted on 2011-03-16
5
500 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

706 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

17 Experts available now in Live!

Get 1:1 Help Now