I have problems in using the .htaccess file. css, js and image can't load if i use .htaccess file.
this my structure simple web. I have some files and folders in the root directory :
1 css folder (include style.css).
@charset "utf-8";
/* CSS Document */
h1 {
color:#F00;
}
1 index.php file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Clean URL</title>
<link href="css/styles.css" rel="stylesheet" />
</head>
<body>
<?php include "bukafile.php"; ?>
</body>
</head>
1 bukafile.php file
<?php
switch ($_GET['page']){
case '' : if(!file_exists ("home.php"))
die ("File Not Found");
include "home.php";
break;
case 'artikel' : if(!file_exists ("artikel.php"))
die ("File Not Found");
include "artikel.php";
break;
default: break;
}
?>
1 home.php file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Clean URL</title>
</head>
<body>
<?php
$sql=mysql_query("SELECT * FROM artikel order by id_artikel");
while ($r=mysql_fetch_array($sql)) {
$judul2 = str_replace(" ","-",$r[judul]);
?>
<p><?php echo"Judul : $r[judul]"; ?></p>
<p><?php echo"<a href='artikel/$r[id_artikel]/$judul2'>detail artikel</a>"; ?></p>
<?php
}
?>
</body>
</head>
1 artikel.php file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Clean URL</title>
</head>
<body>
<h1>Percobaan</h1>
<?php
$detail=mysql_query("SELECT * FROM artikel WHERE id_artikel='$_GET[id]'");
$r = mysql_fetch_array($detail);
echo "<p>$r[judul]</p>";
echo "<p>$r[content]</p>";
?>
</body>
</head>
1 .htaccess file
RewriteEngine on
RewriteRule ^artikel/([0-9]+)/([A-Za-z0-9-]+)/?$ index.php?page=artikel&id=$1 [NC,L]
In this case, css file can't load in artikel php (tag h1) if the source code <link href="css/styles.css" rel="stylesheet" /> but if i change source code <link href="../../css/styles.css" rel="stylesheet" /> it's running well.. so, how can I edit the file htacess without making changes to the source code css?? thank's for the answer