Help With .htaccess Needed Please

Discussion in 'HTML & Website Design' started by gobbly2100, Jan 25, 2007.

  1. #1
    Hello,

    I have a site that is all made with the .htm extention however, with moving times and wanting to do more with the site I would like to change it all to .php but was wondering if it is possible to use a .htaccess file to make all the new .php pages appear as .htm so they are all still cached and ranked by search engines?
     
    gobbly2100, Jan 25, 2007 IP
  2. Valve-Hosting

    Valve-Hosting Peon

    Messages:
    1,071
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    php is indexed and you should use html. How do you think this site is indexed. php code just tells the server to execute that code before doing anythibg else and can be inserted anywhere n html/htm.
     
    Valve-Hosting, Jan 26, 2007 IP
  3. blfast

    blfast Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    A .htaccess file won't cut it. You'll need to change the main server config for the redirects.
     
    blfast, Jan 26, 2007 IP
  4. brunozugay

    brunozugay Peon

    Messages:
    150
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try putting this in your .htaccess file:

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.*)\.htm $1.php [L]
     
    brunozugay, Jan 26, 2007 IP
  5. Blame Me

    Blame Me Guest

    Messages:
    162
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I think this poster was having similar problems to you, check the thread out.

    http://forums.digitalpoint.com/showthread.php?t=192219
     
    Blame Me, Jan 27, 2007 IP
  6. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hello, gobbly2100.
    You don't need

    "to make all the new .php pages appear as .htm"

    because PHP pages are crawled, cached, etc. the same as *.html pages. What
    you must worry about is that pages that are already crawled and indexed
    don't give a 404 error when you do the replacement. To achieve this, the
    way is to use the Redirect directive in the htaccess file.
    Best regards.
     
    TechnoGeek, Jan 27, 2007 IP