dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: aspx permanent redirect help please

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    32

    aspx permanent redirect help please

    Hi,

    I would like to redirect several aspx url's from website A to website B and then, if possible, redirect the remaining urls in a particular folder from website A to website B. Website A is .aspx and website B is .php.

    Eg


    redirect all other url's from www.websiteA.com/folder/ to www.websiteB.com

    I have had a browse on some forums and have found that individual pages can be redirected using the following:

    <script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location","http://www.new-location.com");
    }
    </script>

    However, if the old pages are removed from Website A, then this won't work. Is it possible to add some code to the web.config file?

    I know almost nothing about aspx, so any help would be very much appreciated.

  2. #2
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    Sure. You could also toss those rewrite commands into global.asax. Anywho, I think this is the solution in web.config.

    HTML Code:
    <configuration>
     ... other stuff ...
    
      <system.webServer>
        <rewrite>
          <rules>
            <rule name="redirect page X" stopProcessing="true">
              <match url="~/pagex.aspx" ignoreCase="true" />
              <action type="Redirect" url="http://othersite.com/pageZ.php" />
            </rule>
          </rules>
        </rewrite> 
      </system.webServer>
    
     ... possibly more other stuff ...
    </configuration>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles