Mod rewrite PHP to HTML htaccess |
| Software - Scripting | |
| Written by DanielRo | |
|
In this tutorial you are going to learn how you can rewrite all your PHP pages to HTML using a simple .htaccess rule for better search engine indexing. This is a basic page.php to page.html htaccess script.
There is a myth saying that search engines will better index your site if your pages are displayed like static HTML. 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. 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. Say for example you have a website and a menu witch is dynamically built using PHP, you could only use it on PHP pages. Example: You have menu.php and all the pages of your site: index.php, services.php, portofolio.php, contact.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
RewriteEngine on One would also have to change all the links trough out the website from the PHP extension to HTML. Your visitors can now access the contents of services.php using services.html Using this htaccess basic PHP to HTML rewrite rule you can present PHP files as HTML.
written by rahul111 , November 13, 2008
http://localhost/project/index...egory_id=5 rewrite url : http://localhost/project/index.php/category i use xampp server how can do...
written by occasional Idea , November 26, 2008
How to change dynamic path to .htm or .html path e.g. http://www.domain.com/category.php?cat=1 where cat=1 is "system" convert to http://www.domain.com/system.htm
written by Paul Hutchinson , December 12, 2008
how can i do somthing like this for images? RewriteRule ^(.*).png$ images/$1.png [L] but theres a problem. when trying to view a image it sets of a never ending loop. How can i solve this Thankyou Paul
written by Hitesh Patil , January 05, 2009
I used it. It works but when there is really .htm file and when i access it then it give [file name].php is missing. i mean 404 error. I want that if .htm file is present then it should not seek .php
written by Brandon , January 08, 2009
I did this on my index, which I didn't really know what this did. Now it's asking me to download my index page of my website. How can I take this off, because deleting the .htaccess file didn't turn it off. I hope you reply, because I am so lost here. Do you need more help? Ask now!
|
|
| Last Updated ( Tuesday, 29 July 2008 ) | |