Forum Moderators: phranque
I don’t think that this should affect the traffic to my home page but it will obviously affect hits to other pages ending in .html. I will have to wait for google to index them again before I see the traffic return.
Are there any other implications that I should be aware of?
Here's what happens.
You have a page, index.html
You create a new page, index.php
You modify your .htaccess to handle the redirect.
RewriteRule ^index\.html$ http://yourdomain.com/index.php [L]
What the rewrite does is allow you to change your file extension without worry about losing PR or maintaining existing backlinks. Your SE ranking will not be affected.
There are other ways to skin the same cat, this is the method I prefer.
You should continue to refer to your pages as if they were html documents. If page1.html has a link back to the index, link it thusly: http://www.yourdomain.com/index.html
The .htaccess RewriteRule handles everything for you. If you start to reference your new pages as php pages then you are simply adding duplicate content and more pages to your site.
AddType application/x-httpd-php .htm .html
Make sure to have a linebreak after that line or the server may crash.
An .htaccess file is a simple text file saved as .htaccess
that's dot htaccess
Load this file to your site root directory, the same one your index / homepage file is in. Make sure you transfer it in ascii mode, not binary.
Once you add this line, all your html pages will parse the php and you're set, no changes at all, no mod rewrites, everything is as it was except you now have php processing on all the pages.
Make sure you didn't make a typo or something too, email your hoster and make sure .htaccess works, if not, move on to a new hoster, it's not worth it.
Save it as .htaccess
Do not use notepad or wordpad to make this, if you don't have a real text editor, you can get crimson editor for free.
Upload the file to your root directory using an ftp client. Make sure that your ftp client is set to transfer .htaccess files as ascii. If you don't have an ftp client, use filezilla, it's pretty solid, and free.
Action application/x-php /cgi-bin/php
AddHandler application/x-php .html .htm
In the .htaccess file. I guess
There are other ways to skin the same cat
Thanks again guys, this is going to make things so easy. I can edit all my pages before I upload the .htaccess
I use a real text editor and don't have to pretend. Why use a total piece of garbage that hasn't been modified since maybe 1996 when you can use the real thing? I fail to see the logic behind this decision, probably because there simply is none.
Notepad can insert special characters at odd instances, unpredictable. It's not a real code editor, why use it? Real ones are available for free. Do yourselves a favor, use quality tools. Using notepad is like working on a car with a pipe wrench. It's your right to do that, but why? There is no reason except stubborness that I can see. Anyway, each to their own, poor quality or high quality tools, your choice.
There is no reason except stubborness that I can see.
Garbage is a bit strong, don't you think? And surely it is a real text editor, but maybe not an HTML text editor, but anyway, let's get back on topic.