Mod rewrite PHP to HTML using htaccess
how you can rewrite all your PHP pages to HTML using a simple .htaccess rule for better search engine indexing. This is a basic category.php to category.html htaccess script.
In this tutorial we are providing a script that can only work if you are hosted on a Linux server.
There is a myth saying that search engines will better index your site if your pages are displayed like static HTML.
The language your site is coded in is irrelevant and also a security vulnerability, if people know what language your site is coded in, they’ll more easily be able to exploit any code vulnerabilities.
Personally I don’t believe it actually makes a difference for search engines if your pages are either PHP or HTML but in the long run it can increase your sites security.
Say for example you have a website and a menu witch is dynamically built using PHP, you could only use it on PHP pages.
You have menu.php and all the pages of your site: index.php, product.php, services.php, category.php
Using the following script you will be able to access the contents of all your pages using a HTML extension.
The .htaccess file starts here
RewriteRule ^(.*)\.html$ $1.php [L]
One would also have to change all the links trough out the website from the PHP extension to HTML.
Visitors can now access the contents of products.php using products.html