Jump to content


Php Link Problem

  • Please log in to reply
1 reply to this topic

#1 razorsese

  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts

Posted 26 December 2012 - 04:00 PM

So i got the following url format


now i have 1 link named LI if i click on it it becomes:


and in it i have a list of links if i click on one of them it becomes:


but now if I want to go back to that list if i click on LI it dosen't go back to http://localhost:8080/TST/il but instead it go to


the html code for the link is the following <a href="il">LI</a>

and my .htaccess is the following :

RewriteRule ^([a-zA-Z]*)/?([a-zA-Z]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&action=$2&id=$3 [NC]

#2 DavidAM

  • Moderators
  • Advanced Member
  • 1,980 posts
  • LocationSpring, TX USA

Posted 27 December 2012 - 04:38 AM

You are using a "relative" path in the link. So the browser is building the absolute url by appending the relative part that you specified to the path of the current page. As far as the browser knows, it is looking at a page at http ://localhost:8080/TST/item/view/19 -- filename: 19, path: /TST/item/view -- so it ends up with /TST/item/view/il.

When using mod_rewrite, it is easier (IMO) to always specify full paths (although you can leave the domain part out):
<A href="/TST/il">LI</A>

-- I haven't lost my mind, it's backed up on tape ... somewhere!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users