php - How to make my site use clean urls? -
the code have below makes links such "site.com/image.php?id=12", have tips on making make links such "site.com/image/12" or similar, without manually making page each individual id?
$result = mysqli_query($con,"select * tabl1 name '%$s%'"); while($row = mysqli_fetch_array($result)) { echo "<a href='image.php?id=" . $row['id'] . "'>" . $row['name'] . "</a>"; echo "<br>"; }
i have code on image.php page looks like
$result = mysqli_query($con,"select * celeb id '$id'");
that uses id ?id=12 part on website, i'm not sure how work if did change clean urls.
any useful, kind of newbie php here.
edit:
rewriteengine on rewriterule ^image/id/([^/]*)\.php$ /image.php?id=$1 [l]
i created .htaccess file , put in it, yet when click on link still goes image.php?id=12 doing wrong? there else must do?
this site work http://www.generateit.net/mod-rewrite/
the original url: http://site.com/image.php?id=12 rewritten url: http://site.com/image/12 htaccess: rewriteengine on rewriterule ^image/([^/]*)$ /image.php?id=$1 [l]
Comments
Post a Comment