How Do I 301 Redirect All Old .asp to new .html Pages?

Discussion in 'Apache' started by AtoZNetVentures, Jun 27, 2006.

  1. #1
    Hi All,

    I will be working on a site that has to be moved from a Windows server to a Linux server. The current site's pages all have .asp file extensions. They are all indexed by the search engines and are holding reasonable positions. The site owner has decided to move to Linux for his own reasons and so I have no control over that. Because of this, I understand that I should be using 301 redirects for this. The new file extensions will be .html (the pages are static and there is no database in use.

    Wheel kindly suggested the following:

    Can anyone show me how I would redirect to the new .html pages using my .htaccess file (please note the only thing I've done with .htaccess before is make sure mydomain.com redirects to www.mydomain.com)?

    Also, should I keep the current folder names and file names so that only the file extensions change from .asp to .html?

    Thanks
     
    AtoZNetVentures, Jun 27, 2006 IP
  2. scottj

    scottj Peon

    Messages:
    168
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If it's just the extension that's changing, try something like this:
    RewriteEngine On
    RewriteRule (.*)\.asp $1.html [R=301]
    Code (markup):
    I threw in a 301 redirect code for good measure as well. :)
     
    scottj, Jul 1, 2006 IP
  3. AtoZNetVentures

    AtoZNetVentures Peon

    Messages:
    163
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Scottj! I'll give that a go.
     
    AtoZNetVentures, Jul 1, 2006 IP