> Hi All, > > I am rewriting rule in .htaccess file.I need to convert all .php files > with .html extension. > > Ex: http://localhost/test/test.php to http://localhost/test/test.html > > http://localhost/test/test.php?id=1 to http://localhost/test/test-1.html > > My code is > > Options +FollowSymlinks > RewriteEngine on > RewriteRule ^test-([0-9]+)\.html$ test.php?id=$1 > > if i enter this url in browser "http://localhost/test/test.php?id=1" i > need to show this one in browser "http://localhost/test/test-1.html ". > But my code is displaying this one only > http://localhost/test/test.php?id=1" > > Can you please help me where can i change my code. > > Thanks, > Gangadhar You have a confussion... rewriterules don't change browser display. They do a internal route from an URI to your files. If you need change that browser display, you need send a header new location... your rewrite rule works, if user write "localhost/test/test-1.html" then "localhost/test/test.php=id=1" does the work... now, if you want to hide "test.php" from user, you need your rewrite rule and put this lines at first at all in your test.php: <?php if (strpos($_SERVER['REQUEST_URI'], php) > 0) { header('location: test' . ($_GET['id'] > 0?('-'.$_GET['id']):'') . '.html'); } ?> then, if you enter this url in browser "http://localhost/test/test.php?id=1" your browser show: "http://localhost/test/test-1.html" but test.php?id=1 does the work... hope this help... -- José Miguel Santibáñez jms@xxxxxxxxx