htaccess: 301 Redirect

Discussion in 'Apache' started by AndreasA, Oct 17, 2010.

  1. #1
    Please help me! I have moved my entire site from ASP to PHP and need a 301 Redirect that will send the old asp-page to the new php-page (with the same name - except from the php-extension):

    http://www.mysite.com/test.asp --> http://www.mysite.com/test.php

    Needs also to work with virtual subdomains:

    http://sub.mysite.com/test.asp --> http://sub.mysite.com/test.php

    And default.asp should go to index.php:

    http://www.mysite.com/folder/default.asp --> http://www.mysite.com/folder/index.php


    This is as fare as I reached:

    RedirectMatch (.*)default\.asp$ http://www.mysite.com$1index.php
    RedirectMatch (.*)\.asp$ http://www.mysite.com$1.php

    But it is not a 301 redirect and it doesn't catch subdomains.

    Can someone please help me?

    Thanks,

    Andreasa
     
    AndreasA, Oct 17, 2010 IP