araknid Posted April 17, 2006 Share Posted April 17, 2006 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 https://forums.phpfreaks.com/topic/7611-exploding-urls-messes-up-local-links/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.