.php to .html

Discussion in 'Apache' started by MKInfo, Mar 28, 2006.

  1. #1
    I've tried fiddling with it but to no avail.
    I dont want to change the name of the files etc just the extension.
    Files like faqs.php and contact.php
    I just want them as faqs.html,contact.html etc.
    No matter how I try I cant get it to work :(

    I bet it's easy :eek:
     
    MKInfo, Mar 28, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    :D:D I wasn't going to say anything, but....it can't get any easior that this!! :D:D

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)\.html$ $1.php [L]
     
    Nintendo, Mar 28, 2006 IP
  3. MrSupplier

    MrSupplier Peon

    Messages:
    141
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Another way:
    find string
    AddType application/x-httpd-php .php .....
    add ".html"
    AddType application/x-httpd-php .php .phtml .html
     
    MrSupplier, Mar 28, 2006 IP
  4. MKInfo

    MKInfo DP Guard Dog

    Messages:
    1,481
    Likes Received:
    97
    Best Answers:
    0
    Trophy Points:
    140
    #4
    Thanks guys.I'll get my head around it one day.It doesn't seem to get any easier learning things as you get older.:(
     
    MKInfo, Mar 28, 2006 IP
  5. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #5
    er, are you trying to change the links??!! mod_rewrite doesn't do that!!! Add my code to .htaccess, then go to

    domain.com/contact.html

    and that URL should work...unless you're on a Windows server!!! Though if you were on that, I think you would be using .asp instead of .php.

    The script has to be edited to change the links.
     
    Nintendo, Mar 28, 2006 IP
  6. MKInfo

    MKInfo DP Guard Dog

    Messages:
    1,481
    Likes Received:
    97
    Best Answers:
    0
    Trophy Points:
    140
    #6
    Sorry Nintendo.I should have said........works a treat.I've just got up and not had my morning walkies yet :D

    Thankyou again.
     
    MKInfo, Mar 29, 2006 IP