...

View Full Version : css file doesnt work in url_rewrite mode



gytyonline
12-12-2010, 09:40 AM
hi to all
i have web site and i improve it for seo and now i'm working on friendly url
for example i have this page :


http://mysite.ir/question.php?userid=85&qid=121&title=this-is-a-question

and i use ure_rewrite to change this ugly url to pretty url look somthing like this


http://mysite.ir/questions/85/121/this-is-a-question

for this i use this code in my htaccess :


RewriteEngine on

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

RewriteRule !\.(js|ico|gif|jpg|css)$ distribution.php [L]


i send all request in distribution.php page and there i divide the url and decide
which page should be load :

if(isset($_SERVER['PATH_INFO']))
$path=(substr($_SERVER['PATH_INFO'],-1)=="/")?substr($_SERVER['PATH_INFO'],0,-1):$_SERVER['PATH_INFO'];
else
$path=(substr($_SERVER['REQUEST_URI'],-1)=="/")?substr($_SERVER['REQUEST_URI'],0,-1):$_SERVER['REQUEST_URI'];

$part=array();
$bits=explode("/",substr($path,1));
$bits_size=sizeof($bits);
for($i=0;$i<$bits_size;$i++)
{
$part[]=urldecode($bits[$i]);
if(isset($bits[$i-1]) AND !ctype_digit($bits[$i-1]))
$part[urldecode($bits[$i-1])]=urldecode($bits[$i]);
}

if(($_COOKIE['use']) && ($_COOKIE['pass']) && ($_COOKIE['userid']))
{
switch($part[1])
{
case 'questions':
{
include('question.php');
break;
}
case 'answer':
{
include('answer.php');
break;
}
}
}


but now i have big problem and that is the javascript page and css file doesnt load in any page that i said go there , and if i linke css file with full path it work but in this way :

<link rel="stylesheet" type="text/css" href="style/Style.css"/>

it doesnt work , what should i do now?
i said in htaccess that load js and css pages and doesnt redirect them to distribution.php but it doesnt work:confused::(


RewriteRule !\.(js|ico|gif|jpg|css)$ distribution.php [L]

please help me
thanks a lot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum