darkfreaks Posted September 19, 2008 Share Posted September 19, 2008 okay so when i click on a link it takes me to the correct page but if i click the link again i get 404 errors because it takes me to /products/products when it shoul be /proucts? is there a way to tell it only to go to /products? :-\ Link to comment https://forums.phpfreaks.com/topic/124954-php-linking-problem/ Share on other sites More sharing options...
adam291086 Posted September 19, 2008 Share Posted September 19, 2008 post the code you are using to post the link Link to comment https://forums.phpfreaks.com/topic/124954-php-linking-problem/#findComment-645658 Share on other sites More sharing options...
F1Fan Posted September 19, 2008 Share Posted September 19, 2008 Let's say your website is www.example.com and your file is in the "folder/products" directory. Here's what you need to know: <a target="_blank" href="test.html">test1</a><br> <!-- links to ww.example.com/folder/products/test.html --> <a target="_blank" href="/test.html">test1</a><br> <!-- links to ww.example.com/test.html --> <a target="_blank" href="../test.html">test1</a><br> <!-- links to ww.example.com/folder/test.html --> So, if you always want your links to go to ww.example.com/folder/products/test.html, making all your links: <a target="_blank" href="/folder/products/test.html">test1</a> will work. Link to comment https://forums.phpfreaks.com/topic/124954-php-linking-problem/#findComment-645668 Share on other sites More sharing options...
darkfreaks Posted September 19, 2008 Author Share Posted September 19, 2008 <?php $self = 'admin/index.php'; ?> <html> <head> <title><?php echo $pageTitle; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="admin/include/admin.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/javascript" src="library/common.js"></script> <?php $n = count($script); for ($i = 0; $i < $n; $i++) { if ($script[$i] != '') { echo '<script language="JavaScript" type="text/javascript" src="admin/library/ ' .$script[$i].'"></script>'; } } ?> </head> <body> <table width="750" border="0" align="center" cellpadding="0" cellspacing="1" class="graybox"> <tr> <td colspan="2"><img src="/admin/include/banner-top.gif" width="750" height="75"></td> </tr> <tr> <td width="150" valign="top" class="navArea"><p> </p> <a href="/admin/" class="leftnav">Home</a> <a href="category/" class="leftnav">Category</a> <a href="product/" class="leftnav">Product</a> <a href="order/?status=Paid" class="leftnav">Order</a> <a href="config/" class="leftnav">Shop Config</a> <a href="user/" class="leftnav">User</a> <a href="<?php echo $self; ?>?logout" class="leftnav">Logout</a> <p> </p> <p> </p> <p> </p> <p> </p></td> <td width="600" valign="top" class="contentArea"><table width="100%" border="0" cellspacing="0" cellpadding="20"> <tr> <td> <?php require_once $content; ?> </td> </tr> </table></td> </tr> </table> <p> </p> <p align="center">Copyright © 2005 - <?php echo date('Y'); ?> <a href="http://www.phpwebcommerce.com"> www.phpwebcommerce.com</a></p> </body> </html> Link to comment https://forums.phpfreaks.com/topic/124954-php-linking-problem/#findComment-645670 Share on other sites More sharing options...
F1Fan Posted September 19, 2008 Share Posted September 19, 2008 Again, just add a "/" at the beginning of your links. <a href="/admin/" class="leftnav">Home</a> <a href="/category/" class="leftnav">Category</a> <a href="/product/" class="leftnav">Product</a> <a href="/order/?status=Paid" class="leftnav">Order</a> <a href="/config/" class="leftnav">Shop Config</a> <a href="/user/" class="leftnav">User</a> <a href="/<?php echo $self; ?>?logout" class="leftnav">Logout</a> Link to comment https://forums.phpfreaks.com/topic/124954-php-linking-problem/#findComment-645676 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.