Jump to content
Larry Ullman's Book Forums

How Does Dynamic Routing Work In Php?


Recommended Posts

There is something about php that I have trouble understand coming from using javascript like angular. How does routing in php work exactly?  Like how does a php site know about going to a link 

(/browse/coffee/Dark+Roast/2) or a shop/product link. How does the htacess file works with the site. Currently, when going to a link the /shop/coffee, it responds by not found. I tried to look it up but I don't understand it per say as it different from the way I normally do it in javascript.

<body id="page1">
   <!-- header -->
   <div id="header">
      <div class="container">
         <div class="wrapper">
            <ul class="top-links">
               <li><a href="/index.php" class="first"><img alt="" src="/images/icon-home.gif" /></a></li>
               <li><a href="/cart.php"><img alt="" src="/images/icon-cart.gif" /></a></li>
               <li><a href="/contact.php"><img alt="" src="/images/icon-mail.gif" /></a></li>
               <li><a href="/sitemap.php"><img alt="" src="/images/icon-map.gif" /></a></li>
            </ul>
            <div class="logo">
               <h1><a href="/index.php">Coffee</a><span>Wouldn't you love a cup right now?</span></h1>
            </div>
         </div>
            <ul class="nav">
            <!-- MENU -->
            <li><a href="/shop/coffee/">Coffee</a></li>
            <li><a href="/shop/goodies/">Goodies</a></li>
            <li><a href="/shop/sales/">Sales</a></li>
            <li><a href="/wishlist.php">Wish List</a></li>
            <li><a href="/cart.php">Cart</a></li>
            <!-- END MENU -->
            </ul>
      </div>
   </div>
   <!-- content -->
   <div id="content">
      <div class="container">
         <div class="inside">
Link to comment
Share on other sites

 Share

×
×
  • Create New...