1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Change site from .htm to php site

Discussion in 'Site & Server Administration' started by lateuk, Mar 27, 2007.

  1. #1
    Hello,
    I have a site that links directly to it's own pages (all in 1 directory) via the page name suffixed by .htm or .html

    I want to change the site design to match my other site, so each page has a directory, and within that an index.php file.

    Is there a way to do this via .htaccess or redirects so i dont loose my page ranks, or my placement on the search engines?

    Thanks

    Late
     
    lateuk, Mar 27, 2007 IP
  2. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use mod_rewrite to do a 301 redirect. If you place the following in a domain.com/.htaccess file, it should redirect all pages of the format
    http://domain.com/*.html
    to
    http://domain.com/*/
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule (.*)\.htm(l?) http://www.domain.com/$1/ [R=301,L]
    Code (markup):
     
    rodney88, Mar 27, 2007 IP
  3. lateuk

    lateuk Active Member

    Messages:
    317
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    lateuk, Mar 27, 2007 IP