cara rewriterule .htaccess dengan include file css

gan.. ane mau rewriterule url..udah berhasil > www.domain.com/page/computers.. tapi kog style (file.css) nya gk ke include gan.. jadi berantakan web ane.. :(

url lama : www.domain.com/index.php?tampil=computers rewrite : www.domain.com/page/computers

script index.php ane

<?php
  session_start();
  include ("lib/koneksi.php");
  define("INDEX",true);
 ?>
 <!DOCTYPE html>
 <html>
   <head>
     <meta charset="utf-8">
     <title>domain.com</title>
     <link rel="stylesheet" href="css/master.css" media="screen" title="no title" charset="utf-8">
     <head>
      </head>
   <body>
     <nav>
       <div class="wrapper">
         <h3>domain.com</h3>
         <?php include ("menu.php"); ?>
       </div>
     </nav>
     <div class="clear">
     </div>
     <div class="adsense">
       <p>
         <h6>adsense</h6>
       </p>
     </div>
     <main>
       <div class="wrapper">
         <div class="kiri">
             <?php include ("konten.php"); ?>
         </div>
         <div class="kanan">
           <?php include ("sidebar.php") ?>
         </div>
       </div>
     </main>
     <div class="clear"></div>

     <footer>
       <p>
         <h6>domain.com</h6><br>
       </p>
      </footer>

   </body>
 </html>

script konten.php

<?php
  if(!defined("INDEX")) die("Page Not Found");
  if (isset($_GET['tampil']))     $tampil = $_GET['tampil'];
  else $tampil = "home";
?>

<div class="box">
  <?php
    if ($tampil == "home") include ("konten/home.php");
    elseif ($tampil == "review") include("konten/review.php");
    elseif ($tampil == "halaman") include("konten/halaman.php");
    elseif ($tampil == "store") include("konten/store.php");
    elseif ($tampil == "computers") include("konten/computers.php");
    elseif ($tampil == "gaming") include("konten/gaming.php");
    elseif ($tampil == "phones") include("konten/phones.php");
    elseif ($tampil == "electronics") include("konten/electronics.php");
    elseif ($tampil == "artikel_detail") include("konten/artikel_detail.php");

    else echo "Page Not Found";
   ?>

</div>

RewriteEngine On RewriteRule ^page/([0-9a-zA-Z]+) index.php?tampil=computers [NC]

avatar arepsv
@arepsv

100 Kontribusi 64 Poin

Diperbarui 7 tahun yang lalu

2 Jawaban:

Jawaban Terpilih

cssnya coba dikasih backslash ('/') /css/nama.css sama kalau pake chrome, coba klik kanan, inspect-element, lihat di tab console errornya apa

avatar hilmanski
@hilmanski

2670 Kontribusi 2132 Poin

Dipost 7 tahun yang lalu

makasih mas hilman.. sudah bisa..

 <html>
   <head>
     <meta charset="utf-8">
     <title>domain</title>
     <link rel="stylesheet" href="/domain.com/css/master.css" media="screen" title="no title" charset="utf-8">
     <head>
      </head>
   <body>
     <nav>
       <div class="wrapper">
         <h3>domain.com</h3>
         <ul id="kiriul">
           <li><a href="/domain.com/bestseller.php">Promotions</a></li>
           <li><a href="/domain.com/index.php">Home</a></li>
         </ul>
         <ul id="kananul">
           <li><a href="/domain.com/review/computers">Computers</a></li>
           <li><a href="/domain.com/review/gaming">Gaming</a></li>
           <li><a href="/domain.com/review/phones">Phones</a></li>
           <li><a href="/domain.com/review/electronics">Electronics</a></li>
         </ul>
       </div>
     </nav>

link navigasi nya pake backslash juga :)

avatar arepsv
@arepsv

100 Kontribusi 64 Poin

Dipost 7 tahun yang lalu

Login untuk ikut Jawaban