1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

htaccess wildcard

Discussion in 'Apache' started by aras, May 24, 2007.

  1. #1
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ cat.php?id=$1

    When i did that
    http://domain/cars
    http://domain/autos
    works fine.

    If i add this rule below that one
    RewriteRule ^details/(.*)$ details.php?name=$1

    http://domain/details/ferrari
    does not open details.php. It opens cat.php and gives id=details/ferrari
    It is taking the first wildcard and ignoring the second.

    Moving the second rule upper did not change anything.

    What am i missing?
     
    aras, May 24, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    I think you need to add a backslash for the '/'. Try with:
    RewriteRule ^details\/(.*)$ details.php?name=$1
     
    ajsa52, May 24, 2007 IP
  3. aras

    aras Active Member

    Messages:
    533
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Thanks.

    Had no effect, still same.
     
    aras, May 24, 2007 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    Options +FollowSymLinks +Indexes
    RewriteEngine on
    RewriteBase /
    RewriteRule ^details/([^.]+)$ details.php?name=$1
    RewriteRule ^([^.]+)$ cat.php?id=$1

    or try switching them if it doesn't work.
     
    Nintendo, May 24, 2007 IP