htaccess: Make php pages with html extension?

Discussion in 'Apache' started by Kerosene, Aug 27, 2007.

  1. #1
    I want people to type in domain.com/index.html
    and see index.php

    e.g something like:
    RewriteEngine on
    RewriteBase /
    RewriteRule ^index\.html$ /index\.php
    
    
    Code (markup):
    How can I make this work on ALL (wildcard) pages?
     
    Kerosene, Aug 27, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +FollowSymLinks +Indexes
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)\.html$ $1.php [L]
     
    Nintendo, Aug 27, 2007 IP
  3. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #3
    Praise the lord!

    Thanks :)
     
    Kerosene, Aug 27, 2007 IP
  4. Diablos

    Diablos Guest

    Messages:
    563
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Is there a specific benifit of this action or was it for a more personal/specific reason.
    I do remember someone saying a long time ago it would be better (seo wise) if your site is all php or all html, any truth in this?
     
    Diablos, Aug 28, 2007 IP
  5. m0nkeymafia

    m0nkeymafia Well-Known Member

    Messages:
    399
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    125
    #5
    no truth what so ever
    it does however hide what programming language your using [to the untrained eye anyway] and makes it look more "noob" friendly

    noobs have seen .html before, noobs havent seen .php?weird_att=56565
    noobs get scared :eek:
     
    m0nkeymafia, Aug 28, 2007 IP
  6. Diablos

    Diablos Guest

    Messages:
    563
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Alright thanks for your advice monkeymafia
     
    Diablos, Aug 28, 2007 IP
  7. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #7
    Static makes sure it's search engine friendly for all search engines. Some search engines just hate it when you have stuff like ? and &. And Google hates session IDs.
     
    Nintendo, Aug 28, 2007 IP
  8. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #8
    you could also ask your server admin if they can add in .html as a php parsing extension as well, not sure if that is an option for you, but it is another way to go.
     
    powerspike, Aug 28, 2007 IP
  9. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #9
    The reason I needed to do it = I'm redesigning a site for somebody that already has good PR on their html pages, but I want to use PHP
     
    Kerosene, Aug 28, 2007 IP
  10. cyanide

    cyanide Peon

    Messages:
    483
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Then your best bet is to edit htacess with this:
    This code will allow you to run php scripts in an html page.
    That way you don't have to do any url re-writing.. much better :)
     
    cyanide, Aug 28, 2007 IP
  11. Diablos

    Diablos Guest

    Messages:
    563
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I do have an issue with sessions on the newest site I am working on, have you already done a thread targeting this issue or can you give me a few tips here, or is it just the same as rewriting any dynamic url?
     
    Diablos, Aug 29, 2007 IP
  12. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #12
    You just edit the script to take them out of the URL. Let registered members use cookies!
     
    Nintendo, Aug 29, 2007 IP
  13. Diablos

    Diablos Guest

    Messages:
    563
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #13
    OK :) I'll have a word with our programmers and see what we can do, thanks.
     
    Diablos, Aug 30, 2007 IP
  14. yinka007

    yinka007 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I am trying to embed php into my site that has a .html extension, I followed the above example but it did not work
     
    yinka007, Jun 4, 2008 IP