Changing site from html to php

by 17 replies
20
I need to add php code to my site. What is the best way to do this without having a negative effect on my rankings. Do I have to change all the file extensions and 301 redirect the old html pages to the new php ones? I kinda want to go at this one page because I'm scared of screwing everything up.
#programming #changing #html #php #site
  • Best would be to make your .html files parse as PHP files. This way you get the power of PHP without the need to change any URLs
    • [ 1 ] Thanks

  • Create an .htaccess rule

    application/x-httpd-php .php .html

    or similiar
    • [1] reply
    • 2 Questions
      Do I have to start all my documents with a piece of php code?
      I read somewhere I should only parse the pages where I will actually use php code. Is there a way to just parse a certain directory or each individual page?

      Thanks for the help.
      • [2] replies
  • First, prepare your .html files for conversion and then redirect HTML file requests to PHP files using your .htaccess file. If you don't have, create a file and the following code to that file and save it.

    RedirectMatch permanent ^(.*)\.htm(l?)$ $1.php

    the above query will take request for .html files and redirect it to .php.
  • You can just copy the .html file to .php file. thats all.
    • [1] reply
    • That's only a half-truth that only sometimes turns out to be true; it's not a given. It all depends on whether or not your hosting environment has the PHP engine installed and integrated with your web server. The web server also needs to be configured to parse (or handle) files with the .php extension as PHP. i.e. it sends the PHP bits to the PHP engine to interpret and the PHP engine sends back the HTML output to the web server.
      • [1] reply
  • you have to make sure you have a web server like apache installed as well
    • [1] reply
    • just rename your .html to .php and add htaccess rules.
  • If you've already done some SEO work on the old site and you change to .php files make sure that you add some redirects to your webserver configuration file (or htaccess).
    • [1] reply
    • I wonder if this is going to affect my site ranking. Now two of my keywords are coming in the first page in the googe. I'm afraid that this change may affect my keyword positions. Need some advice...
      • [1] reply
  • I can help you out. Hit me up.

Next Topics on Trending Feed

  • 20

    I need to add php code to my site. What is the best way to do this without having a negative effect on my rankings. Do I have to change all the file extensions and 301 redirect the old html pages to the new php ones? I kinda want to go at this one page because I'm scared of screwing everything up.