How to rewrite a URL using htaccess?

Using .htaccess want to change the urls of my site from .php extension to .html?

  • using .htaccess file i am able to change the www.domain/index.php to www.domain/index.html using the following code: Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule ^(.*)\.html$ $1.php using this code if i give the url as www.domain/index.html it is showing the same content as in www.domain/index.php and also other files as search.php to serach.html But i want the hyperlinks given in the entire site to change as (.)html extension i.e if i mouse over the hyperlink i want it to view as search.html and not search.php

  • Answer:

    If you edit the hyperlinks to say .html, this is what they should show. Better is to use the : AddType application/x-httpd.php .html directive. This allows the server to run php in html files. You could then rename all the files to .html and set all the links to .html without incurring the overhead of translation.

Anil Kumar at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.