Jump to content

Exploding URLs messes up local links


araknid

Recommended Posts

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:
[code]        
$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++;    
                }
            }
        }
[/code]

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:
[code]<img src='templates/logo.png'>[/code] 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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.