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.
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
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
rewrite url : http://localhost/project/index.php/category
i use xampp server
how can do...
written by jeo , November 26, 2008
written by occasional Idea , November 26, 2008
How to change dynamic path to .htm or .html path
http://www.domain.com/category.php?cat=1 where cat=1 is "system"
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
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.
written by tran thai , April 30, 2009
thank you for useful informations about mod rewrite.
written by Amit Sidhpura , July 24, 2009
Thanks man, after half an hour of search this is the page where i found the required solution. Thanks again..Keep it up..
written by AndrewAM , September 29, 2009
I notice none of the questions have been answered?
I have been trying for a few weeks to rewrite php file extensions to html and have been failing, I've used exactly the same code posted in so many forums but no success? Any ideas?
written by Natalya Shirinova , February 02, 2010
how to change from
plz help, thanks
written by Mayur Shah , February 03, 2010
RewriteRule ^(.*).html $1.php
This is useful when you need to convert from PHP to html extensions same time if you need to pass more parameter with different php file than need to write something like this
RewriteRule (.*).htm$ /page.php?file=$1
We had done with this like you can see both options is working fine
http://www.addonsolutions.com hire php developer . html
There are more options too
Do you need more help? Ask now!
|Last Updated ( Tuesday, 29 July 2008 )|