I Need PHP to work on my .html pages. Is this right?

Discussion in 'Apache' started by comanche82, Nov 28, 2007.

  1. #1
    I don't want to loose my SEO and back links by changing all my page extensions from .html to .PHP. I have this in my .htaccess

    Options  +FollowSymLinks
    
    RewriteEngine  On
    
    RewriteRule ^([^.]+).html$ /$1.php [QSA,L]
    
    
    Code (markup):
    Is this right?

    Almost all of my page extensions are in .html. I have a few that are saved with .htm. I also have some pages saved with .PHP.

    The only code I have in my .htaccess file is the code posted here, it doesn't work. I don't know anything about .htaccess files. Can you please let me know what I have to do?

    Thank You
     
    comanche82, Nov 28, 2007 IP
  2. pig2cat

    pig2cat Active Member

    Messages:
    299
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #2
    What this code here does is that if you go to
    yoursite.com/page.html , it shows that it;s on page.html, but actually tries to go to page.php (which isn't there)

    what you can do is:
    wait for someone to post a different code

    or rename all your Html pages to .php (they'll still show up as .html, and are accesable by the html))
     
    pig2cat, Nov 28, 2007 IP
  3. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You should ask your host to add .html as a php extension, they can do that for you.
     
    powerspike, Nov 28, 2007 IP
  4. Jackel.ca

    Jackel.ca Well-Known Member

    Messages:
    108
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #4
    Try the following in your .htaccess

    
    AddType application/x-httpd-php .html 
    
    Code (markup):
     
    Jackel.ca, Nov 29, 2007 IP
  5. qualityhostings

    qualityhostings Well-Known Member

    Messages:
    1,764
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    105
    #5
    This code may cause errors. I have done this before on my server. And found errors. I cant remember what it was exactly, because I tried this before a year.
    I think .httaccess may be fine
     
    qualityhostings, Dec 3, 2007 IP
  6. rdokoye

    rdokoye Peon

    Messages:
    84
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Sorry...so are you saying to rename the file from .htaccess to .httaccess? Because I'm having the same problem to.
     
    rdokoye, Dec 10, 2007 IP
  7. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #7
    .htaccess is correct

    The problem most likely relates to the name of the hosts php handler. I imagine you'd be looking for

    
    AddType application/x-httpd-php4 .html
    
    Code (markup):
    Or for PHP5

    
    AddType application/x-httpd-php5 .html
    
    Code (markup):
     
    InFloW, Dec 10, 2007 IP
  8. comanche82

    comanche82 Well-Known Member

    Messages:
    732
    Likes Received:
    79
    Best Answers:
    0
    Trophy Points:
    118
    #8
    Thanks everyone for you’re help but I tried everything and I can’t get any of this to work. Do you think it could be because I have my hosting with windows and not Linux?
     
    comanche82, Dec 17, 2007 IP