Connecting Tech Pros Worldwide Forums | Help | Site Map

mod_rewrite - Link Problem

Newbie
 
Join Date: Nov 2007
Location: Malaysia
Posts: 1
#1: Nov 2 '07
This is my testing...

In main.php:
<html>
<head><title></title></head>
<body>
<? imclude("new.php") ?>
<? include("detail.php") ?>
</body>
</html>


In new.php:
<?
echo "<a href=\"test/artist/paul\">Paul</a><br>";
echo "<a href=\"test/teacher/kurt\">Kurt</a><br>";
echo "<a href=\"test/racer/mike\">Mike</a><br>";
?>


In detail.php:
<?
if(a == "artist"){
if(b == "paul"){ echo "Yes, Paul."; }
else if(b == "kurt"){ echo "Yes, Kurt."; }
else if(b == "mike"){ echo "Yes, Mike."; }
else{ echo "Nobody here."; }
}
else{ echo "Not artist."; }
?>


In .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^test/(.[^\/]*)/(.[^\/]*)$ main.php?a=$1&b=$2 [L]


Now, my problem is:

I hover to any links of the new.php, the links are shown in correct way:
e.g. Link of Paul shown in status bar is:
http://www.example.com/test/artist/paul
e.g. Link of Kurt shown in status bar is:
http://www.example.com/test/teacher/kurt
e.g. Link of Mike shown in status bar is:
http://www.example.com/test/racer/mike

After I click on the link:
e.g. http://www.example.com/band/artist/paul
And the output is correct:
Yes, Paul.

And I hover to the links in new.php again, the links are shown in incorrect way:
e.g. Link of Paul shown in status bar is:
http://www.example.com/test/artist/test/artist/paul
e.g. Link of Kurt shown in status bar is:
http://www.example.com/test/artist/test/teacher/kurt
e.g. Link of Mike shown in status bar is:
http://www.example.com/test/artist/test/racer/mike

Any body know how to solve this problem? Thanks in advanced.

Reply