Jump to content


Photo

Exploding URLs messes up local links


  • Please log in to reply
No replies to this topic

#1 araknid

araknid
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 17 April 2006 - 04:40 PM

Hi, I am writing a content management system and tried implementing mod_rewrite with it. Then I tried exploding the URL to get the same effect. Here is the code I used to do this:
        
$path_info = $_SERVER["PATH_INFO"];
        if($path_info){
            $path_info = explode("/", $path_info);
            
            $i = 0;
            foreach($path_info as $path_part){
                if($path_part != ""){
                    if($i == 0){
                        $pg = $path_part;
                    }elseif($i == 1){
                        $page_input = $path_part;
                    }else{
                        $page_input .= "," . $path_part;
                    }
                    $i++;    
                }
            }
        }

Both mod_rewrite and exploding URLs causes the same problem. Things can't be linked locally. For example, if my the URL is [a href=\"http://somesite.com/araknid/index.php\" target=\"_blank\"]http://somesite.com/araknid/index.php[/a], I can say:
<img src='templates/logo.png'>
and it would world properly. But if the url was [a href=\"http://somesite.com/araknid/index.php/forum/t,12\" target=\"_blank\"]http://somesite.com/araknid/index.php/forum/t,12[/a] it doesn't work because it tries to load
[a href=\"http://somesite.com/araknid/index.php/forum/t,12/templates/logo.png\" target=\"_blank\"]http://somesite.com/araknid/index.php/foru...plates/logo.png[/a] , instead of [a href=\"http://somesite.com/ararak/index.php/templates/logo.png\" target=\"_blank\"]http://somesite.com/ararak/index.php/templates/logo.png[/a].

How can I fix this?

Thanks in advance.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users