Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question css file doesnt work in url_rewrite mode

    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 :

    Code:
    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

    Code:
    http://mysite.ir/questions/85/121/this-is-a-question
    for this i use this code in my htaccess :

    Code:
    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 :
    Code:
    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 :
    Code:
    <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

    Code:
    RewriteRule !\.(js|ico|gif|jpg|css)$ distribution.php [L]
    please help me
    thanks a lot.
    Last edited by gytyonline; 12-12-2010 at 10:45 AM.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •