I spent a couple of hours trying to achieve something that seemed easy to me. I http://localhost/testing_url_document/second.php?id=2
also want to turn it http://localhost/testing_url_document/second/id/2
. I achieved to remove the php extension, but was stuck in rewriting the site page. In htacces, I performed the following procedure.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
this is my index page
Index.php
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
?>
<a href="second/id/2">click here</a>
</body>
</html>
Second.php
<?php
echo $_GET['id'];
?>
Second .php should get value 2
Thanks in advance for your help.
source
share