Some links work, some other not

Discussion in 'PHP' started by hihihehe, May 10, 2010.

  1. #1
    Dear all,

    My site have some links work such as

    http://chotrungtam.com/shop-11/ngocthai
    http://chotrungtam.com/shop-10/tsangjunho

    Some other links just show the homepage

    http://chotrungtam.com/shop-17/Congtyseo1

    I don't know what is problem: database, seo, code...

    Please could you give me a clue for this,

    Grateful,
     
    hihihehe, May 10, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    Might be an .htaccess rewrite rule issue (it may refer to your homepage instead of what you expect...)
     
    danx10, May 10, 2010 IP
  3. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #3
    mfscripts, May 10, 2010 IP
  4. musicmasteria

    musicmasteria Peon

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Might want to consider adding a / to the end of your urls.
    chotrungtam.com/shop-17/Congtyseo1/ - works
    chotrungtam.com/shop-17/Congtyseo1 - doesn't
    chotrungtam.com/shop-17/Congtyseo - works but shouldn't

    I believe you have a problem in the code that checks the given username (Congtyseo1) with username's in the database. It looks like it's doing a contains comparison vs. an equals comparison.

    Do you have some code that we could look at?
     
    musicmasteria, May 10, 2010 IP
  5. hihihehe

    hihihehe Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Great help!!!

    Thank you very much for mfscripts and musicmasteria for your brilliant suggestions. I am going to fix this issue and will report here
     
    hihihehe, May 11, 2010 IP
  6. hihihehe

    hihihehe Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi,

    I am unable to fix this. Here is .htaccess and the php file named thanhvien.php. Please could you have a look at these files and give a help.

    Thanks!!!

    ErrorDocument 404 /
    ErrorDocument 403 /
    #####
    RewriteEngine on
    #####
    RewriteRule ^trang-chu/$ index.php
    ##########################
    RewriteRule ^dang-nhap/$ index.php?mod=dangnhap
    RewriteRule ^dang-ky/$ index.php?mod=dangki
    RewriteRule ^thay-doi-thong-tin/$ index.php?mod=suataikhoan
    RewriteRule ^thoat/$ index.php?mod=dangnhap&act=logout
    RewriteRule ^tin-nhan/$ index.php?mod=tinnhan
    RewriteRule ^luu-san-pham/$ index.php?mod=sanphamluu
    RewriteRule ^tin-tuc/$ index.php?mod=tintuc
    RewriteRule ^dang-ban/$ index.php?mod=dangban
    RewriteRule ^rao-vat/$ index.php?mod=raovat
    RewriteRule ^tuyen-dung/$ index.php?mod=tuyendung
    RewriteRule ^danh-muc-san-pham/(.*)$ index.php?mod=chungloai&cid=$1
    RewriteRule ^chi-tiet-san-pham/(.*)$ index.php?mod=chitietsp&pid=$1
    RewriteRule ^shop-(.*)/([a-zA-Z]*)$ index.php?mod=thanhvien&us_id=$1
    
    RewriteRule ^danh-muc-tin-tuc/(.*)$ index.php?mod=tintuc&cid=$1
    RewriteRule ^chi-tiet-rao-vat/(.*)$ index.php?mod=chitietraovat&rid=$1
    RewriteRule ^chi-tiet-tuyen-dung/(.*)$ index.php?mod=chitiettuyendung&tid=$1
    RewriteRule ^chi-tiet-tin-tuc/(.*)/(.*)$ index.php?mod=chitiettintuc&tid=$1&cid=0
    RewriteRule ^san-pham/(.*)$ index.php?mod=sanpham&u_id=$1
    RewriteRule ^tuy-chon/$ index.php?mod=tuychon
    RewriteRule ^ban-be/(.*)$ index.php?mod=banbe&u_id=$1
    
    RewriteRule ^tim-loai-san-pham/tinh-thanh/(.*)/(.*)$ index.php?mod=chungloai&cid=$1&ttid=$2
    RewriteRule ^g-tim-loai-san-pham/theo-gia/(.*)/(.*)-(.*)$ index.php?mod=chungloai&cid=$1&act=theogia&fgid=$2&tgid=$3
    RewriteRule ^k-tim-loai-san-pham/(.*)/tu-khoa=(.*)$ index.php?mod=chungloai&cid=$1&tukhoa=$2
    RewriteRule ^sua-san-pham/(.*)$ index.php?mod=capnhatsp&pid=$1
    RewriteRule ^c-luu-san-pham/(.*)$ index.php?mod=chitietsp&pid=$1&act=luusanpham
    RewriteRule ^gui-tin-nhan/(.*)$ index.php?mod=tinnhan&m=guitin&u_name=$1
    RewriteRule ^ket-ban/(.*)$ index.php?mod=ketban&friend_id=$1
    RewriteRule ^sua-nhan-xet/(.*)/(.*)$ index.php?mod=chitietsp&pid=$1&act=edit_comment&cm_id=$2
    RewriteRule ^trich-dan-nhan-xet/(.*)/(.*)$ index.php?mod=chitietsp&pid=$1&act=quote_comment&cm_id=$2
    RewriteRule ^gop-y/$ index.php?mod=gopy
    RewriteRule ^sua-tin-rao-vat/(.*)$ index.php?mod=suatinraovat&rid=$1
    RewriteRule ^danh-muc-rao-vat/(.*)$ index.php?mod=raovat&cid=$1
    
    RewriteRule ^doi-mat-khau/$ index.php?mod=doimatkhau
    RewriteRule ^xem-tin-nhan/(.*)$ index.php?mod=tinnhan&m=xem&tid=$1
    RewriteRule ^nganh-san-pham/(.*)/(.*)$ index.php?mod=sanpham&u_id=$1&nganh=$2
    RewriteRule ^danh-muc-tuyen-dung/(.*)$ index.php?mod=tuyendung&cid=$1
    RewriteRule ^chi-tiet-tuyen-dung/(.*)$ index.php?mod=chitiettuyendung&tid=$1
    RewriteRule ^sua-tin-tuyen-dung/(.*)$ index.php?mod=suatintuyendung&tid=$1
    RewriteRule ^tim-kiem/(.*)$ index.php?mod=timkiem&keyword=$1
    RewriteRule ^t-tim-kiem/tinh-thanh/(.*)$ index.php?mod=timkiem&ttid=$1
    RewriteRule ^g-tim-kiem/theo-gia/(.*)-(.*)$ index.php?mod=timkiem&act=theogia&fgid=$1&tgid=$2
    RewriteRule ^dang-tin-rao-vat/$ index.php?mod=dangtinraovat
    RewriteRule ^t-tim-rao-vat/tinh-thanh/(.*)$ index.php?mod=raovat&ttid=$1
    RewriteRule ^quan-ly-tin-rao-vat/$ index.php?mod=raovat&modu=quanlytindang
    RewriteRule ^dang-tin-tuyen-dung/$ index.php?mod=dangtintuyendung
    RewriteRule ^t-tim-kiem-tuyen-dung/tinh-thanh/(.*)$ index.php?mod=tuyendung&ttid=$1
    RewriteRule ^quan-ly-tin-dang-tuyen-dung/$ index.php?mod=tuyendung&modu=quanlytindang
    RewriteRule ^tin-da-gui/$ index.php?mod=tinnhan&m=tingui
    RewriteRule ^xem-tin-nhan/(.*)$ index.php?mod=tinnhan&m=xem&tid=$1
    ###########################
    ErrorDocument 404 /
    ErrorDocument 403 /
    
    
    Code (markup):
     

    Attached Files:

    hihihehe, May 11, 2010 IP
  7. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #7
    put trailing slash :)
     
    gapz101, May 11, 2010 IP
  8. hihihehe

    hihihehe Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    As I understand the necessary trailing slash was placed into the .htaccess already.

    but it was not shown on the url
     
    hihihehe, May 11, 2010 IP
  9. hihihehe

    hihihehe Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    A ha I found that every links that contain number will not work.

    How can I fix this.

    Thanks
     
    hihihehe, May 11, 2010 IP
  10. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #10
    I think this

    Needs to be this

     
    mfscripts, May 11, 2010 IP
  11. hihihehe

    hihihehe Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    OK it's fine now.

    Thanks alot for your help!!!
     
    hihihehe, May 11, 2010 IP
  12. musicmasteria

    musicmasteria Peon

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Glad to hear you got it fixed.

    The glitch I mentioned earlier turned out to be nothing. I see in your code that the user id is the after the 'shop-' so the username is just there for looks.
     
    musicmasteria, May 11, 2010 IP