Changing My Index.html file to Index.Php...

Discussion in 'PHP' started by bad_bob00, Mar 25, 2008.

  1. #1
    Hi,

    I want to add a PHP menu to my website but the tutorial I am reading states that I will need to save my index file as index.php (instead of .html).

    I'm just wondering if this will affect my search engine position or page rank at all? Do I have to save the file as .php for the menu to work?


    Thanks for any help, as you can see I am new to PHP...
     
    bad_bob00, Mar 25, 2008 IP
  2. Valdor

    Valdor Well-Known Member

    Messages:
    450
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    185
    #2
    what is the tutorial you are reading, if its online i will take a look, I know you can include php functions if you have the shtml extension eg index.shtml
     
    Valdor, Mar 25, 2008 IP
  3. bad_bob00

    bad_bob00 Active Member

    Messages:
    3,472
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #3
    bad_bob00, Mar 25, 2008 IP
  4. Valdor

    Valdor Well-Known Member

    Messages:
    450
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    185
    #4
    try this:
    it came from this site
    http://www.theukwebdesigncompany.com/articles/article.php?article=314
    Code (markup):
    Hope this helps.
     
    Valdor, Mar 25, 2008 IP
  5. bad_bob00

    bad_bob00 Active Member

    Messages:
    3,472
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #5
    Thanks Valdor, I will give this a go.

    If I upload the new index.shtml file will I need to delete my index.html file? Will this cause a change in SERPS?


    Thanks :)
     
    bad_bob00, Mar 25, 2008 IP
  6. Valdor

    Valdor Well-Known Member

    Messages:
    450
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    185
    #6
    i wouldnt think so.
     
    Valdor, Mar 25, 2008 IP
  7. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #7
    changing from .html to .shtml is the same as changing from .html to .php

    if you are refering to your domain as domain.com without domain.com/index.html ... this will not cause any serp results .

    since index.(php | html | htm | asp | ..) is the default .

    the problem will occur if u change domain.com/test.html to domain.com/test.php

    and a solution for this is to use 301 redirection

    good luck
     
    commandos, Mar 25, 2008 IP
  8. Marc Fraser

    Marc Fraser Peon

    Messages:
    283
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Or you can create a .htaccess file and add this:

    
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)\.html$ $1.php [R=permanent]
    
    Code (markup):
    and then you can rename your index to .php, but it will show to browsers, humans and SE's as .html.
    (this will show all pages that have {pagename here}.php to {pagename here}.html (although the "pagename here" will actually be the pagename!))

    Regards,
    Marc
     
    Marc Fraser, Mar 25, 2008 IP
  9. bad_bob00

    bad_bob00 Active Member

    Messages:
    3,472
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #9

    Instead of 301 redirection could I use the .htaccess file and do a redirect that way?

    I will be needing to change all of my pages from .html to .php


    Thanks for the help
     
    bad_bob00, Mar 26, 2008 IP
  10. bad_bob00

    bad_bob00 Active Member

    Messages:
    3,472
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #10
    If I put the redirect in my .htaccess file this way would it be okay?:

    redirect 301 /mypagename.html http://mywebsite.com/mypagename.php


    Would that work okay and keep the search engine position?

    Thanks for any help
     
    bad_bob00, Mar 26, 2008 IP
  11. lamelime

    lamelime Peon

    Messages:
    360
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I think it might affect it because all of the previous links to your site would be directed to the index.html, not .php, but it might work because the links might just be redirected automatically to the .php. But make sure you delete the index.html fully.
     
    lamelime, Mar 26, 2008 IP