i got a funny rewrite url

Discussion in 'Apache' started by xbl1, Nov 24, 2007.

  1. #1
    Hi;
    I got a problem with rewrite url, could anyone help me, please.

    i am trying to rewrite a url to "http://www.mysite.com/country/page/3/". but the browser give me
    the url of "http://www.kam2.biz/country/page/1/country/page/3/" when i click a link
    from the page of the "http://www.kam2.biz/country/page/1/", and it brings me 404 error massage.


    The works i have done as following;

    .htacess file
    RewriteEngine On
    RewriteRule ^([a-z]+)/page/([0-9]+)/$ /Category.php?catName=$1&page=$3 [L]


    index.php
    note: when i click any link from the following, it does the rewrite url well,
    for example, give me the rewrite url with the "http://www.mysite.com/country/page/1/".
    <a href="world/page/1/"> the world </a> <br>
    <a href="country/page/1/">the country </a> <br>

    Category.php
    note: when i click any link from the following, it give me a funny rewrite url,
    for example,a rewrite url with "http://www.kam2.biz/country/page/1/country/page/3/"
    <a href="world/page/8/"> the world </a> <br>
    <a href="country/page/3/">the country </a> <br>
     
    xbl1, Nov 24, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    <a href="/world/page/1/"> the world </a> <br>

    or include the full URL in the link. Links have to be as if they are the real URL. Browsers have no idea you're using mod_rewrite.
     
    Nintendo, Nov 24, 2007 IP
  3. xbl1

    xbl1 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a lot, it works now.
     
    xbl1, Nov 24, 2007 IP