External Redirect .php files to .html files (SEO friendly)

Most of the developers like to show PHP  files as HTML. This can be done via htaccess.  .htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis. In htaccess, we have Rewrites. Htaccess Rewrites are enabled by using the Apache module mod_rewrite, which is one of the most powerful Apache modules and features availale. Htaccess Rewrites through mod_rewrite provide the special ability to Rewrite requests internally as well as Redirect request externally. So, if URL comes like http://www.vijayakumar.org/example.html. This URL will be rewritten as http://www.vijayakumar.org/example.php. To do this, we want to place the below line into htaccess, which was presented in root directory(htaccess will be hidden, try accessing hidden files in your root directory. If not presented?, please create a new htaccess file in root directory).

RewriteRule (.*)\.html $1.php

You can leave a response, or trackback from your own site.

One Response to “External Redirect .php files to .html files (SEO friendly)”

  1. Naren says:

    Hey nice work vijay….u done a great job

Leave a Reply