So i got the following url format
localhost:8080/test
now i have 1 link named LI if i click on it it becomes:
http://localhost:8080/TST/il
and in it i have a list of links if i click on one of them it becomes:
http://localhost:8080/TST/item/view/19
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
http://localhost:8080/TST/item/view/il
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]
Php Link Problem
Started by razorsese, Dec 26 2012 11:00 AM
1 reply to this topic
#1
Posted 26 December 2012 - 11:00 AM
#2
Posted 26 December 2012 - 11:38 PM
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):
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












