mannyee Posted March 19, 2010 Share Posted March 19, 2010 hey guys!! I am trying to redirect a page to other pages by using anchors <a> in html as follows: < Quote <a href="<?php echo WEB_ROOT; ?>admin/" class="leftnav">Home</a> <a href="<?php echo WEB_ROOT; ?>admin/category/" class="leftnav">Category</a> <a href="<?php echo $self; ?>?logout" class="leftnav">Logout</a> and the page in which this code resides is http://127.0.0.1/project8/admin/index.php But when i click the Home link in the page the page redirects to Quote http://127.0.0.1/project8/admin/project8/admin where I need only http://127.0.0.1/project8/admin/. The same is the case for Category Instead of redirecting to http://127.0.0.1/project8/admin/category, the page redirects to Quote http://127.0.0.1/project8/admin/project8/admin/category and here WEB_ROOT is calculated to project8 What should i do now? Thanks in advance!! Link to comment https://forums.phpfreaks.com/topic/195839-redirecting-without-concatenating/ Share on other sites More sharing options...
hcdarkmage Posted March 19, 2010 Share Posted March 19, 2010 Try removing the WEB_ROOT from your links. Link to comment https://forums.phpfreaks.com/topic/195839-redirecting-without-concatenating/#findComment-1028724 Share on other sites More sharing options...
mannyee Posted March 19, 2010 Author Share Posted March 19, 2010 Try removing the WEB_ROOT from your links. Quote But if i did that i would be able to move , say to categories folder, but i would have to go back to the Home to go to the Product(which i omitted in the code for brevity). I want to visit the category pages and without moving back to the index page(home) i wud want to move to the products page by directly clicking the products link Link to comment https://forums.phpfreaks.com/topic/195839-redirecting-without-concatenating/#findComment-1028725 Share on other sites More sharing options...
fr34k Posted March 19, 2010 Share Posted March 19, 2010 If WEB_ROOT contains "project8," then you should be using absolute paths, not relative. Ex: <a href="/<?php echo WEB_ROOT; ?>/admin/" class="leftnav">Home</a> Link to comment https://forums.phpfreaks.com/topic/195839-redirecting-without-concatenating/#findComment-1028730 Share on other sites More sharing options...
mannyee Posted March 19, 2010 Author Share Posted March 19, 2010 Quote If WEB_ROOT contains "project8," then you should be using absolute paths, not relative. Hippy!! that works!! Thanks fr34k..... Link to comment https://forums.phpfreaks.com/topic/195839-redirecting-without-concatenating/#findComment-1028732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.