I'm a complete novice when it comes to rewrites, I don't know enough about the code, and am frankly terrified of doing the wrong thing in converting my .html web pages to .php. (BTW, the reason for the conversion - to add header and footer includes plus dynamic features.)
So far, I've found the .htaccess rewrite rule.
PHP Code:
RewriteEngine on
RedirectMatch permanent ^(.*)\.html$ $1.php
(I'd prefer not to include rewriting .htm pages as all of MY pages are .html)
However, I'm very concerned about how search engines will treat this, and the implications for getting the site to be re-indexed.
I've read that a better SEO technique may be to set up a 301 redirect (or is this exactly the same as what I've just proposed?)
Something like:
PHP Code:
RewriteEngine on
RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php
I'm concerned that "playing" with htaccess may land me in deep waters, and any advice much appreciated.
I did it and did not have any problems... once you change your page extension from .html to .php it counts as a different page in Google so pagerank is lost.
…how much of a disaster to the client is this? A matter of 2-4wks?
Donatello - Much appreciate yr swift reply - I'm guessing I'm on the right track, anyway. I've heard some people use .htacess to get .html pages to act as .php
This seems overly complex - but could it be a useful approach. Or do I just get on with conversion and let the client know of temp. loss of pagerank?
Convert html to php OR Make Apache parse .html as .php?
Thanks, all
And now… which would be the best method, in your opinions?
I have two options:
1/ Convert html to php
My main concern is that this will scupper Pagerank (how big a deal is this? - how long to "repair" pagerank?)
2/ Make Apache parse .html as .php
How will my testing server treat this - i.e. so that I can work locally on pages?
When I changed over from HTML to PHP, all I did was change the extensions. Though my site is still in HTML, I wanted php for the include function. Static Header makes life easier lol.
You shouldn't have an issue just changing the extensions and updating the links.
You will also notice that I had to add the handler for Godaddy to force php5. Even though I changed it in my hosting panel, for some reason it was continuing to run php4... so in frustration I fixed it with the .htaccess fix you see above.
Bookmarks