How to custom url?

Hi Everybody,

I am working a project that display product image. So to get more details about the products i put link, so when we hover the image we get a link like:

localhost/kbashop/display.html.php?name=alcatel.jpg

So how can i modify the above link to something like: localhost/kbashop/alcatel.html ?

I have seen on many ecommerce site.

<?php include_once'includes/connect.php'; try { $sql = "SELECT filename FROM productlist LIMIT 4"; $s = $pdo->query($sql); $result = $s->fetchAll(PDO::FETCH_ASSOC); $counter = 0; } catch (PDOException $e) { $error = "Problem with your code".$e->getMessage(); } ?> KBASHOP figcaption { text-align:center; font-weight: bold; font-size: 12px; border: 2px solid olive; padding-top: 5px; }
 </head>

KBAShop.com

 </header>
<ul class="products">
<?php foreach($result as $row): $name = $row['filename']; list($width, $height) = getimagesize("images/thumbs/$name"); ?>
<li>
  
    <a href="display.html.php?name=<?php echo $name;?>">
<img src="images/thumbs/<?php echo $row['filename']?>" width="<?php echo $width;?>" height="<?php echo $height;?>"/>
     
    </a>

</li>
<?php endforeach;?>
</div>
<div class="footer-info cf"> 
  <p>&copy; Copyright - Tous droits r&eacute;serv&eacute;s aux test - 2015</p>
</div>


</footer>

Please any link to tutorial or tips or advise on this topics will really like saving.

So here i am putting my code for more help.

Thanks

You need to change your a tags to actually be how you want them to look for one.
Then you need an .htaccess file that routes the url to the proper location.
You may also want a router script that can parse the values in the url.

I agree with astonecipher, do a google search for “URL REWRITE .HTACCESS”

You need to edit htacess file like some like this. Use ur logic also

[code]Options +FollowSymLinks
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^.*$ ./index.php[/code]

Sponsor our Newsletter | Privacy Policy | Terms of Service