help with .htaccess

Discussion in 'Apache' started by sojic, Jul 14, 2009.

  1. #1
    I have this scenario:

    site.com/dir/watch.php?category=main&movie=moviename

    i want to make it site.com/dir/watch/main/moviename

    I place .htaccess into dir
    
    RewriteEngine on
    
    RewriteRule ^watch/(.+)/(.+)\.html$ watch.php?category=$1&movie=$2
    
    Code (markup):
    and few variations... but it do not work.... It open watch.php but seams that category and movie name can not "get"

    So it show watch.php without parametars.
     
    sojic, Jul 14, 2009 IP
  2. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't know if (.+) is a valid expression, maybe it was just a fluke it didn't work for me once.

    try replacing it with (.*)

    if it still doesn't work, try adding [QSA,L] to the end of the htaccess entry.
     
    szalinski, Aug 20, 2009 IP
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule watch/(.*)/(.*)/$ watch.php?category=$1&movie=$2

    use that
     
    Bohra, Aug 20, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Actually, you'll want to change that to:

    RewriteRule ^watch/(.*)/(.*)/?$ watch.php?category=$1&movie=$2
    Code (markup):
    As the / can sometimes be forgotten.
     
    premiumscripts, Aug 21, 2009 IP